-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[DOC] Clarify some tick-related docstrings #26619
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.
Um bunch of comments trying to make things more explicit while also balancing conciseness. I also think a good follow up could be an example showing what all these mean. kinda like https://matplotlib.org/devdocs/gallery/subplots_axes_and_figures/axis_equal_demo.html
lib/matplotlib/axes/_base.py
Outdated
This affects the tick components (tick markers, tick labels, grid lines), the | ||
axis lines (spines) and the axis labels. |
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 affects the tick components (tick markers, tick labels, grid lines), the | |
axis lines (spines) and the axis labels. | |
This removes the axis labels, axis spines, and the axis tick components, which are the tick markers, tick labels, and grid lines. |
removing parenthesis and I think spine is fine in context
'square' Square plot; similar to 'scaled', but initially forcing | ||
``xmax-xmin == ymax-ymin``. |
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.
should this maybe be moved under scaled then?
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.
As above: scaling is not in the scope of the PR
Additionally, further autoscaling will be disabled. | ||
'tight' Set limits just large enough to show all data, then | ||
disable further autoscaling. | ||
'auto' Automatic scaling (fill plot box with data). |
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.
what does fill plot box (Axes?) with data mean?
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.
As above: scaling is not in the scope of the PR
4bba6cc
to
7296cf2
Compare
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've rewritten the docstrings for set_axis_on/off
with the focus on making it clear that set_axis_off()
is a global switch to hide all decorations (I intentionally use "hide" and not "remove" because the latter has a notion of delete.)
@@ -2090,7 +2090,7 @@ def _set_tick_locations(self, ticks, *, minor=False): | |||
|
|||
def set_ticks(self, ticks, labels=None, *, minor=False, **kwargs): | |||
""" | |||
Set this Axis' tick locations and optionally labels. | |||
Set this Axis' tick locations and optionally tick labels. |
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 function is then Axes.set_yticks
. While "y" is in the function name, it's nice to mention the axis in the docstring explicitly, because Axes has more than one axis.
7296cf2
to
7ed2711
Compare
lib/matplotlib/axes/_base.py
Outdated
'on' or `True` Do not hide all axis decorations, i.e. axis labels, spines, | ||
tick marks, tick labels, and grid lines. | ||
This is the same as `~.Axes.set_axis_on()`. | ||
'off' or `False` Hide all axis decorations, i.e. axis labels, spines, | ||
tick marks, tick labels, and grid lines. | ||
This is the same as `~.Axes.set_axis_off()`. |
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.
'on' or `True` Do not hide all axis decorations, i.e. axis labels, spines, | |
tick marks, tick labels, and grid lines. | |
This is the same as `~.Axes.set_axis_on()`. | |
'off' or `False` Hide all axis decorations, i.e. axis labels, spines, | |
tick marks, tick labels, and grid lines. | |
This is the same as `~.Axes.set_axis_off()`. | |
'off' or `False` Hide all axis decorations, i.e. axis labels, spines, | |
tick marks, tick labels, and grid lines. | |
This is the same as `~.Axes.set_axis_off()`. | |
'on' or `True` Do not hide axis decorations, i.e. axis labels, spines, | |
tick marks, tick labels, and grid lines. | |
This is the same as `~.Axes.set_axis_on()`. | |
partly b/c off is more commonly used, partly b/c 'do not hide all' is doing something strange where it can still mean 'hide some' -which is true but not what the sentence is trying to say, so it's maybe clearer if set up as a contrast to 'off'
lib/matplotlib/axes/_base.py
Outdated
|
||
This affects the axis lines, ticks, ticklabels, grid and axis labels. | ||
This is an Axes-wide setting to suppress drawing of all axis decorations, i.e. |
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 an Axes-wide setting to suppress drawing of all axis decorations, i.e. | |
This setting suppresses drawing of all axis decorations, i.e. |
per convo w/ @QuLogic, I don't think the term Axes-wide
adds anything so I'd rather we not create a new term.
Apply suggestions from code review Co-authored-by: hannah <[email protected]>
7ed2711
to
a2adf8b
Compare
…619-on-v3.8.x Backport PR #26619 on branch v3.8.x ([DOC] Clarify some tick-related docstrings)
Inspired by #26612.