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

Propose refactoring axes.typ #23

Closed
wants to merge 8 commits into from

Conversation

jamesrswift
Copy link
Collaborator

When I was working on implementing log axes, I found myself having to navigate what felt like a single-file code spaghetti backwards and forwards, and thought that it was probably the right size to split into separate files.

Blocked by #21 and #18 (this PR will be updated to refactor them too)

@johannes-wolf johannes-wolf self-requested a review July 29, 2024 16:36
@jamesrswift jamesrswift marked this pull request as ready for review July 29, 2024 18:41
@jamesrswift
Copy link
Collaborator Author

Ready for review, of note: plots.formats has been moved to axes.formats

@@ -54,7 +54,7 @@ module imported into the namespace.
= Plot

#doc-style.parse-show-module("/src/plot.typ")
#for m in ("line", "bar", "boxwhisker", "contour", "errorbar", "annotation", "formats") {
#for m in ("line", "bar", "boxwhisker", "contour", "errorbar", "annotation",) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we add /src/axes/format.typ somewhere? Maybe also for the other axes stuff, which was kind of “hidden” until now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely, I'll work on that tomorrow I think

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so I'm looking at it and the plot documentation sufficiently describes relevant axes functions that it would be verbose to add them twice. What I'd suggest is that we keep it hidden (or only show it in some sort of "advanced" documentation) because my gut feeling is that it would confuse people.

One nitpick I have with myself is that tick formatters do belong in axes but they are only ever used as an argument for {n}-format in plot.plot - could we alias the tick formatters so they can be accessed through both plot and axes? Or would that set a bad precedent?

@@ -0,0 +1,153 @@
#import "/src/cetz.typ": util, draw, styles, vector
#import "../style.typ": default-style, _prepare-style, _get-axis-style
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was some reason to use absolute paths, but idk. anymore…

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave it in for a separate refactor to deal with as I don't feel I know enough to properly do that

@jamesrswift jamesrswift marked this pull request as draft July 30, 2024 16:03
@jamesrswift jamesrswift marked this pull request as ready for review July 30, 2024 16:05
@jamesrswift
Copy link
Collaborator Author

(sorry about the spam)

@jamesrswift
Copy link
Collaborator Author

Converted to draft as this can be implemented more simply if a more aggressive refactor is undertaken first (in progress).

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