[DOC] Clarify some tick-related docstrings#26619
Conversation
story645
left a comment
There was a problem hiding this comment.
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.
| 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.
should this maybe be moved under scaled then?
There was a problem hiding this comment.
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.
what does fill plot box (Axes?) with data mean?
There was a problem hiding this comment.
As above: scaling is not in the scope of the PR
4bba6cc to
7296cf2
Compare
timhoffm
left a comment
There was a problem hiding this comment.
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.)
| 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.
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.
| '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
| Hide all visual components of the x- and y-axis. | ||
|
|
||
| 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.
| 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.