Skip to content

Deprecate Tick.apply_tickdir. #19655

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
merged 2 commits into from
Mar 10, 2021
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Mar 6, 2021

apply_tickdir doesn't actually update the tick markers on the existing
Line2D objects used to draw the ticks (as can be checked with e.g.
plt.gca().xaxis.majorTicks[2].apply_tickdir("inout")), so it's really
mostly an internal helper that cannot be meaningfully called from
outside (it needs to cooperate with _apply_params to actually work).

PR Summary

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • 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).

@anntzer anntzer added this to the v3.5.0 milestone Mar 6, 2021
apply_tickdir doesn't actually update the tick markers on the existing
Line2D objects used to draw the ticks (as can be checked with e.g.
`plt.gca().xaxis.majorTicks[2].apply_tickdir("inout")`), so it's really
mostly an internal helper that cannot be meaningfully called from
outside (it needs to cooperate with `_apply_params` to actually work).
@@ -209,15 +209,18 @@ def _set_labelrotation(self, labelrotation):
_api.check_in_list(['auto', 'default'], labelrotation=mode)
self._labelrotation = (mode, angle)

def apply_tickdir(self, tickdir):
def _apply_tickdir(self, tickdir):
Copy link
Member

Choose a reason for hiding this comment

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

Since you've dug into the logic: Can you extend the docstring to explain what this does/not, and how it has to be used with _apply_params. (Or if thats the case: that it only works when called from within _apply_params?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I further simplified the coordination between apply_params and apply_tickdir by getting rid of _tickmarkers (directly setting them in apply_tickdir) and letting apply_params be in charge of staleness.
Also extended the comment to explain what _appky_tickdir is responsible for.

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

modulo @timhoffm comment....

... which is otherwise just an attribute to coordinate between
_apply_params and _apply_tickdir.
@timhoffm timhoffm merged commit c6329dc into matplotlib:master Mar 10, 2021
@anntzer anntzer deleted the apply_tickdir branch March 10, 2021 01:01
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