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

[DOC] Clarify some tick-related docstrings #26619

Merged
merged 1 commit into from
Aug 30, 2023

Conversation

timhoffm
Copy link
Member

Inspired by #26612.

Copy link
Member

@story645 story645 left a 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 Show resolved Hide resolved
Comment on lines 3434 to 3435
This affects the tick components (tick markers, tick labels, grid lines), the
axis lines (spines) and the axis labels.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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

lib/matplotlib/axes/_base.py Outdated Show resolved Hide resolved
lib/matplotlib/axes/_base.py Outdated Show resolved Hide resolved
lib/matplotlib/axes/_base.py Outdated Show resolved Hide resolved
lib/matplotlib/axes/_base.py Outdated Show resolved Hide resolved
lib/matplotlib/axes/_base.py Outdated Show resolved Hide resolved
lib/matplotlib/axes/_base.py Show resolved Hide resolved
Comment on lines +2045 to +2044
'square' Square plot; similar to 'scaled', but initially forcing
``xmax-xmin == ymax-ymin``.
Copy link
Member

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?

Copy link
Member Author

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).
Copy link
Member

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?

Copy link
Member Author

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

@story645 story645 added the Documentation: API files in lib/ and doc/api label Aug 29, 2023
@timhoffm timhoffm force-pushed the doc-ticks-visible branch 2 times, most recently from 4bba6cc to 7296cf2 Compare August 29, 2023 22:14
Copy link
Member Author

@timhoffm timhoffm left a 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.
Copy link
Member Author

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.

lib/matplotlib/axes/_base.py Outdated Show resolved Hide resolved
Comment on lines 2025 to 2027
'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()`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'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'


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.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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 <story645@gmail.com>
@oscargus oscargus modified the milestones: v3.8-doc, v3.8.0 Aug 30, 2023
@oscargus oscargus merged commit 0b50f1e into matplotlib:main Aug 30, 2023
40 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 30, 2023
@timhoffm timhoffm deleted the doc-ticks-visible branch August 30, 2023 06:49
timhoffm added a commit that referenced this pull request Aug 30, 2023
…619-on-v3.8.x

Backport PR #26619 on branch v3.8.x ([DOC] Clarify some tick-related docstrings)
@ksunden ksunden mentioned this pull request Sep 15, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation: API files in lib/ and doc/api Documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants