Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ENH: update ticks when requesting labels #23170

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

Merged
story645 merged 3 commits into matplotlib:main from jklymak:enh-update-ticks
Jun 2, 2022

Conversation

Copy link
Member

@jklymak jklymak commented May 31, 2022
edited
Loading

PR Summary

I think if the user asks for the tick labels, they should be allowed to waste a few cpu cycles actually getting the tick labels rather than forcing a whole draw. However, its possible I don't understand some subtlety.

Ref: #6103. Probably a lot more, and many stack overflow issues.

import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
ax.plot(range(10))
labels = ax.xaxis.get_majorticklabels()
print(labels)

Current behaviour

[Text(0, 0, ''), Text(0, 0, ''), Text(0, 0, ''), Text(0, 0, ''), Text(0, 0, ''), Text(0, 0, ''), Text(0, 0, '')]

Proposed behaviour

[Text(-2.0, 0, '−2'), Text(0.0, 0, '0'), Text(2.0, 0, '2'), Text(4.0, 0, '4'), Text(6.0, 0, '6'), Text(8.0, 0, '8'), Text(10.0, 0, '10')]

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

story645 reacted with thumbs up emoji
@jklymak jklymak marked this pull request as ready for review May 31, 2022 15:34
Copy link
Member Author

jklymak commented Jun 1, 2022

Is this a situation where our pre-commit CI hook contradicts what flake8 asks for?

@tacaswell tacaswell added this to the v3.6.0 milestone Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@tacaswell tacaswell tacaswell approved these changes

@story645 story645 story645 approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.6.0
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /