Skip to content

DOC: Rewrite tickabel rotation example to use rotation_mode#31222

Merged
story645 merged 1 commit intomatplotlib:mainfrom
timhoffm:ticklabels_rotation
Mar 2, 2026
Merged

DOC: Rewrite tickabel rotation example to use rotation_mode#31222
story645 merged 1 commit intomatplotlib:mainfrom
timhoffm:ticklabels_rotation

Conversation

@timhoffm
Copy link
Copy Markdown
Member

@timhoffm timhoffm commented Mar 2, 2026

Closes #31221.

The old version was not quite meaningful so I replaced the whole example.

I've left out the variant with set_xticks(positions, labels, rotation=...). It has the disadvantage of updating the individual ticks instead of the defaults, which breaks when zooming. We therefore have substantially removed its use in our examples. I didn't want to discuss this topic here, and actually there are very few cases in which one still needs to set tick positions and labels explicitly as most of that can be handled through categorical units.

@github-actions github-actions Bot added the Documentation: examples files in galleries/examples label Mar 2, 2026
Copy link
Copy Markdown
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.

Can you please add tags since you're already updating the example?

@timhoffm timhoffm force-pushed the ticklabels_rotation branch from d4cc9cc to bd78ef8 Compare March 2, 2026 01:03
@timhoffm
Copy link
Copy Markdown
Member Author

timhoffm commented Mar 2, 2026

Added tag component: ticks. I'm not quite clear what we want as tags. Feel free to change/amend.

# - `matplotlib.axes.Axes.tick_params` / `matplotlib.pyplot.tick_params`
# - `matplotlib.axes.Axes.set_xticks` / `matplotlib.pyplot.xticks`
#
# .. tags:: component: ticks
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also can you add plot-type:bar ?

@story645
Copy link
Copy Markdown
Member

story645 commented Mar 2, 2026

Anything folks would be likely to look this up based on, which I think here is bar charts, ticks, and labeling

https://matplotlib.org/devdocs/devel/tag_guidelines.html

ETA: also thanks!

@timhoffm timhoffm force-pushed the ticklabels_rotation branch from bd78ef8 to f59b20b Compare March 2, 2026 08:07
@github-actions github-actions Bot added the Documentation: devdocs files in doc/devel label Mar 2, 2026
@timhoffm
Copy link
Copy Markdown
Member Author

timhoffm commented Mar 2, 2026

Done.

Note: https://matplotlib.org/devdocs/devel/tag_glossary.html#api-tags-what-content-from-the-api-reference-is-in-the-example listed component: label twice (l.24 and l.36). I fixed that as a drive-by. It's so small that it's not worth doing a separte PR.

@story645 story645 added this to the v3.11.0 milestone Mar 2, 2026
@story645 story645 merged commit 2bd2c45 into matplotlib:main Mar 2, 2026
20 checks passed
@story645
Copy link
Copy Markdown
Member

story645 commented Mar 2, 2026

I fixed that as a drive-by.

Thanks!

@timhoffm timhoffm deleted the ticklabels_rotation branch March 2, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation: devdocs files in doc/devel Documentation: examples files in galleries/examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Doc]: ticks/ticklabels_rotation example should mention rotation_mode="xtick"/"ytick"

2 participants