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
To do and Tracking:
Axis Styles
Currently tracked are orthrect-2d and polar-2d. Wanted are: barycentric-2d, polar-3d, and orthorect-3d.
Orthorect-2d (previously scientific axis style)
Polar-2d (previously scientific-polar)
Plot elements
There are many more plot elements to introduce too, so if anything needs adding to the list, we should.
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 inplot/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), anddraw-axes(responsible for drawing the axes).make-ctxnow supplies an arrayaxesrather than separately providingxandy, as a more general solution for when higher dimensional plots are implemented. It must also providecompute-fill-pathsandcompute-stroke-paths(previously supplied by theutil.typmodule) 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 underplot.add.<name>, andplot.addhas becomeplot.add.xyto disambiguate.The school-book axis style remains unimplemented but I hope to bring it back at a later stage
To do and Tracking:
aggressive-refactorbranch (Aggressive refactoring #27)Axis Styles
Currently tracked are
orthrect-2dandpolar-2d. Wanted are:barycentric-2d,polar-3d, andorthorect-3d.Orthorect-2d (previously
scientificaxis style)Polar-2d (previously
scientific-polar)Plot elements
add.xyfor plotting continuous/continuous data.cetz-plot/src/chart.typ
Line 1 in cb8505b
There are many more plot elements to introduce too, so if anything needs adding to the list, we should.