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

AxisArtist to use standard tick directions and have an option for tick orientation#24553

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

Open
leejjoon wants to merge11 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromleejjoon:aa-tickdir

Conversation

leejjoon
Copy link
Contributor

PR Summary

This is a rebased version of PR#19102 that addresses issue#19101. It also add an option to change the orientation of ticks. The ticks in AxisArtist were drawn along the gridlines and may not be perpendicular to spines. This PR introduce an option oftick_orientation that controls this behavior so that it can be normal to spines (see the discussion in#19102).

  • It will respect "xtick.direction" and "ytick.direction" in rcParams.
  • Thetick.orientation can be one of "parallel", "normal" and "auto". Defaut is "auto".
    • 'parallel' - ticks along the grid lines
    • 'normal' - ticks normal to axis line.
    • 'auto' - 'normal' if tickdir is 'out' else 'parallel'

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (andpytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a.. versionadded:: directive in the docstring and documented indoc/users/next_whats_new/
  • API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

else "parallel")

return tick_orientation

def set_tick_out(self, b):
Copy link
Member

@oscargusoscargusNov 28, 2022
edited
Loading

Choose a reason for hiding this comment

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

Maybe we should deprecate these now? (set/get_tick_out)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

At what version do we want it to be deprecated?

Copy link
Member

Choose a reason for hiding this comment

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

I'd say 3.7.

Copy link
Member

Choose a reason for hiding this comment

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

I think this could fit in our normal warn for one release, remove the next pattern, but would defer to you if you wanted to put the new version in for a cycle before we started (or pushed the removal date out further).

# If ticklabels and axislabel are on differenct side, we only
# conside the padding for the ticks only.

ticksizes = []
Copy link
Member

@oscargusoscargusNov 28, 2022
edited
Loading

Choose a reason for hiding this comment

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

Can you add a test that uses this path? (And ideally "all" the newly introduced options.)

Edit: one way to at least test theout/in/inout combinations would be to regenerate some of the test images below.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, I will do.

@@ -21,6 +21,9 @@ def test_subplot():
# remove when image is regenerated.
@image_comparison(['curvelinear3.png'], style='default', tol=5)
def test_curvelinear3():
# Remove this lines when this test image is regenerated.
plt.rcParams.update({"xtick.direction": "in", "ytick.direction": "in"})
Copy link
Member

@oscargusoscargusNov 28, 2022
edited
Loading

Choose a reason for hiding this comment

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

If I get it correct, this changes the current behavior? Not sure if we should introduce some way to make that transition smoothly, but at least a change note would be in place, I guess.

(Edit: this comment holds for the whole change, not just this line.)

Copy link
Member

Choose a reason for hiding this comment

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

When we went to v2 we changed ticks from in to out, however because AxisArtist did not follow the rcparams they did not flip when everything else did.

I do not think there is a way to soften this change short of adding another rcparam.

I think we should go forward with this, but make sure there is a very clear API change note.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I have added a deprecation warning at the level of Tick creation and relevant tests. On the other hand, users won't see the warning unless they manually create a Tick instance. I briefly thought about adding atickdir keyword argument for Axes initialization, but not very inclined for now. I agree with@tacaswell that it is better to go with it.

@@ -62,7 +62,7 @@

Copy link
Member

Choose a reason for hiding this comment

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

The line above (which I cannot mark...) should be updated as well?

Currently:

 ax.axis["bottom"].major_ticks.set_tick_out(True)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

@oscargusoscargusoscargus left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@leejjoon@tacaswell@oscargus@anntzer

[8]ページ先頭

©2009-2025 Movatter.jp