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

[Tracking] Refactor #28

Open
10 of 27 tasks
jamesrswift opened this issue Aug 1, 2024 · 0 comments
Open
10 of 27 tasks

[Tracking] Refactor #28

jamesrswift opened this issue Aug 1, 2024 · 0 comments
Assignees
Milestone

Comments

@jamesrswift
Copy link
Collaborator

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

To do and Tracking:

  • Pull current work into aggressive-refactor branch (Aggressive refactoring #27)
  • Refactor the refactor: In moving code around a lot, boilerplate code has become prominent. It has been left in this PR because it does not adversely affect the implementation of features, but it is something that will need seeing to as a final step before merging this branch into main
  • Update the manual: Currently failing CI due to having not updated the manual.
  • Change axis styles from being modules to being dictionaries and a constructor to allow for a finer grained control over how any axis style is rendered

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)
  • Reintroduce not drawing unset axes
  • School-book axis style
  • Verify that logarithmic scales are still working
  • Improve clipping function performance (Improved Rect Clipping #29)
  • Flipping axes does not appear to work
Polar-2d (previously scientific-polar)

Plot elements

  • add.xy for plotting continuous/continuous data.
    • Add thorough tests
  • Annotations
  • Area chart ((W.I.P) Area chart #34)
  • Bar/Column (Bar element and barchart #31)
    • horizontal bars will be supported through swapped axes and a wrapper
    • Stacked100 isn't exposed to public api
      #import "charts/bar/bar.typ" as bar: stacked, clustered, simple
  • Boxplot
  • Bubble plot
  • Contour
  • Error bar
    • Compute stroke paths using clipper
  • Violin plot
  • Series
    • Marks are not drawn within a series - needs investigation

There are many more plot elements to introduce too, so if anything needs adding to the list, we should.

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

No branches or pull requests

2 participants