Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggressive refactoring #27

Merged

Conversation

jamesrswift
Copy link
Collaborator

@jamesrswift jamesrswift commented Aug 1, 2024

When implementing logarithmic plots, and then when implementing polar plots, I ran into the challenge that the axis style has no control over how the data is plotted. This make sense if you treat axis styles as a purely visual element, however, this PR turns them into "drivers" that can change more behaviour of the underlying plot.

This is the initial PR, to allow people a better chance at collaborating on the refactor as well as to give maintainers a better chance at reviewing changes in smaller chunks rather than one hefty PR

Firstly, axis styles have been moved out of axes.typ (like in a previous draft PR), and instead are located in plot/axis-styles/. They become modules which must currently provide 3 functions: make-ctx (responsible for constructing the context within which data is prepared), data-viewport (responsible for transforming data along any number of axes, and onto the plot itself), and draw-axes (responsible for drawing the axes).

make-ctx now supplies an array axes rather than separately providing x and y, as a more general solution for when higher dimensional plots are implemented. It must also provide compute-fill-paths and compute-stroke-paths (previously supplied by the util.typ module) to allow for a finer grained control over clipping (of note: path computation occurs PRIOR to data-viewport transformations)

Plot elements (previously plot.add-<name>()) are now under plot.add.<name>, and plot.add has become plot.add.xy to disambiguate.

The school-book axis style remains unimplemented but I hope to bring it back at a later stage

Tracking can be found here: #28

@jamesrswift jamesrswift mentioned this pull request Aug 1, 2024
27 tasks
@johannes-wolf johannes-wolf merged commit 5cec42b into cetz-package:aggressive-refactoring Aug 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants