Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: Improve module docs of matplotlib.scale #29353

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

Merged
merged 1 commit into from
Dec 21, 2024

Conversation

timhoffm
Copy link
Member

No description provided.

@timhoffm timhoffm added the Documentation: API files in lib/ and doc/api label Dec 20, 2024
@timhoffm timhoffm force-pushed the doc-scales branch 3 times, most recently from 7c82a2a to fe238da Compare December 20, 2024 10:40
@timhoffm timhoffm marked this pull request as ready for review December 20, 2024 11:26
Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

Couple of small suggestions you can take or leave.


See also `.axes.Axes.set_xscale` and the scales examples in the documentation.
Scales are subclasses `ScaleBase`. Their mapping is implemented through `.Transform`
Copy link
Member

Choose a reason for hiding this comment

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

This is pretty technical for right at the top? Maybe down around the new L26 would be better?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've reduced to

The mapping is implemented through .Transform subclasses.

Because that's context needed to understand why the transform columns in the subsequent table exist.

I agree that the technical details are not relevant for users. They are basically only needed when you want to implement your own scales. That information is (although not very concise) available in the ScaleBase docstring and the Custom scale example. Therefore we can leave it out of the introductory paragraph. I may later improve the custom scale example. But that's a separate topic.


Custom scaling can be achieved through `FuncScale`, or by creating your own
`ScaleBase` subclass (see :doc:`/gallery/scales/custom_scale`).
Third parties can register their scales by name through `register_scale`.

Matplotlib also supports non-separable transformations that operate on both
Copy link
Member

Choose a reason for hiding this comment

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

I find this sentence pretty confusing on its own. Appreciate you are just changing the formatting here, but if we are improving things, we might mention that the previous scales act on one axis at a time, and are for Cartesian axes.

Copy link
Member Author

Choose a reason for hiding this comment

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

, and are for Cartesian axes.

This is not quite true, you can e.g set a log radial axis in a polar plot.

I'm tempted to leave out the paragraph. I think that scales and projections are mostly independent of each other (but am not completely sure).

Copy link
Member

Choose a reason for hiding this comment

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

Ok fair enough. Maybe "scales are typically applied individually to the axis of a separable axes. Non-separable axes are dealt with using projections". But maybe you are correct that you could do without it here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've removed that paragraph. Irrespective of the exact technical relationship. People looking at scales will typically have a certain projection (mostly cartesian axes) in mind and only consider the scaling behavior along the given axes. It's likely not helpful for them to bring up the topic of other projections here.

@timhoffm timhoffm added this to the v3.10.1 milestone Dec 21, 2024
@timhoffm timhoffm merged commit 5c3f2f6 into matplotlib:main Dec 21, 2024
37 of 39 checks passed
@timhoffm timhoffm deleted the doc-scales branch December 21, 2024 23:23
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Dec 21, 2024
timhoffm added a commit that referenced this pull request Dec 22, 2024
…353-on-v3.10.x

Backport PR #29353 on branch v3.10.x (DOC: Improve module docs of matplotlib.scale)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants