-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Update Axes docs on aspect-related methods #9964
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very helpful. A few suggestions!
'datalim' change xlim or ylim | ||
'box-forced' same as 'box', but axes can be shared | ||
============ ===================================== | ||
Set the aspect of the axis scaling, i.e. the ratio of y-unit to x-unit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
axis->Axes ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's really the ratio of y-axis-scaling to x-axis-scaling, not the aspect of the Axes bounding box.
lib/matplotlib/axes/_base.py
Outdated
value description | ||
======== ================================================ | ||
'auto' automatic; fill position rectangle with data | ||
'equal' same scaling from data to plot units for x and y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scaling from data to Axes co-ordinates the same for the x and y
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the original description, which I've not modified. I think both versions are not exactly helpful to the point for different reasons.
Overall, I think we would need a dedicated help page to explain, coordinates, scaling and the related terminology, which is not always consistent and/or self-explanatory.
I prefer to leave it like this for the moment.
lib/matplotlib/axes/_base.py
Outdated
======== ================================================ | ||
'auto' automatic; fill position rectangle with data | ||
'equal' same scaling from data to plot units for x and y | ||
num a circle will be stretched such that the height |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scaling from data to Axes co-orindates of y dimensions is num times the x dimension. a circle will...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
===== ===================== | ||
See Also | ||
-------- | ||
matplotlib.axes.Axes.set_adjustable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these need to be made as links?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Deleting comments below just to keep things clean...
lib/matplotlib/axes/_base.py
Outdated
Adjust the axes so that it fulfills its aspect setting. | ||
|
||
Depending on `.get_adjustable` and `.get_anchor` this will either modify | ||
they axes box or the view limits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...the Axes" (I think we capitalize Axes, maybe incorrect, but I think it makes sense since its not the plural of axis here?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We capitalize Axes
because it's a Python class and that's PEP8 style. We don't capitalize axes if it's not referring to the class/an instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are referring to an instance here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this and a few other cases in the above functions.
Note that the distinction is by far not always made in the code. Speaking just of _AxesBase
, maybe 2/3 the cases use "axes" where it should be "Axes" according to your rules. IMO this distinction is not too important in many cases, unless you want a strong connotation to the class-type, in which case you would use the reference `Axes`
anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I only suggest it because of the linguistic strangeness of referring to "axes" as singular, so at least if we use "Axes" we can say its a singular proper noun.
1f7b450
to
a94f682
Compare
Thanks a lot @timhoffm ! |
PR Summary
This PR contains updated docstrings on