Movatterモバイル変換


[0]ホーム

URL:


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: call update_ticks before we return them to the user#20345

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

jklymak
Copy link
Member

PR Summary

Currently,get_x/yticks doesn't work until a draw is called. But we can update the ticks, so why not?

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

@jklymakjklymak changed the titleENH: call updateticks before we return them to the userENH: call update_ticks before we return them to the userJun 2, 2021
@jklymakjklymak marked this pull request as ready for reviewJuly 27, 2021 13:34
@jklymakjklymak added this to thev3.5.0 milestoneJul 27, 2021
@jklymak
Copy link
MemberAuthor

This one is pretty basic; if someone asks for the ticks on an axis, I don't see why we would force them to do a whole draw...

Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

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

That this is so basic makes me suspicious: Why haven't we done such a simple thing before?

My first guess "we use it heavily in the codebase (and it thus might be a performance issue)" is not correct. Apart from one usage inSecondaryAxis this is only used in tests an a tutorial. Why? Because internally we useget_minorticklocs() andget_majorticklocs(). Since both of them are public API as well, they should have the same update state asget_ticklocs(). I.e. if we update that should happen in there.

Now, I'm not sure what the implication of that would be._update_ticks() queriesget_minorticklocs() andget_majorticklocs() so we'd need to have a closer look on that cyclic usage. It might also be the case that we should make the currentget_major/minorticklocs private for internal use without update and have change the public variants to use updates.

Anyway I'm afraid only adding_update_ticks() here is too simple.

@jklymak
Copy link
MemberAuthor

I'm actually confused now what prompted this. Going back to 3.3.0

importmatplotlib.pyplotaspltimportnumpyasnpfig,ax=plt.subplots()ax.plot(np.arange(100))print(ax.xaxis.get_majorticklocs())print(ax.xaxis.get_minorticklocs())print(ax.get_xticks())

works as expected. So I'll close this until we can remember why this was an issue.

@QuLogic
Copy link
Member

This was re-done by#23170, because it wasn't really working as stated above.

@QuLogicQuLogic modified the milestones:v3.5.0,v3.6.0May 3, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm requested changes

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

Successfully merging this pull request may close these issues.

3 participants
@jklymak@QuLogic@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp