FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

ENH: update ticks when requesting labels by jklymak · Pull Request #23170 · matplotlib/matplotlib · GitHub

Repository navigation

ENH: update ticks when requesting labels - #23170

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

story645 merged 3 commits into
matplotlib:mainfrom
jklymak:enh-update-ticks

Conversation

jklymak commented May 31, 2022 •
edited
Loading

Copy link
Copy Markdown
Member

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).

jklymak marked this pull request as ready for review May 31, 2022 15:34
jklymak force-pushed the enh-update-ticks branch from c97d3b8 to bbff015 Compare June 1, 2022 07:12

jklymak commented Jun 1, 2022

Copy link
Copy Markdown
Member Author

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

tacaswell added this to the v3.6.0 milestone Jun 2, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL