Skip to content
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

Make tick_left/right keep labels off if they are already off #9670

Merged
merged 5 commits into from Nov 13, 2017

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Nov 2, 2017

PR Summary

This modifies XAxis.tick_left and X-axis.tick_right to keep the tick labels turned off if the major
labels are already turned off.

Not 100% convinced this is the right thing to do, but fixes #9664 Wild guess is that this doesn't break anything, whereas the new behaviour did.

Fixes:

import matplotlib.pyplot as plt

f, axes = plt.subplots(1, 2, sharey=True)
axes[1].yaxis.tick_left()
plt.show()

Breaks:

The following if the user expected tick_left() to turn the labeling back on.

import matplotlib.pyplot as plt

f, ax = plt.subplots(1, 2)
ax.yaxis.set_tick_params(which='both', labelleft=False)
ax.yaxis.tick_left()
plt.show()

I'm not sure why this would happen, but this PR breaks that case...

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way
  • fix tick_top tick_bottom

@mwaskom
Copy link

mwaskom commented Nov 2, 2017

Does this address the corresponding changes in tick_bottom/tick_top?

@jklymak
Copy link
Member Author

jklymak commented Nov 2, 2017

@mwaskom Not yet - see todo list above...

Note its also not working yet

@mwaskom
Copy link

mwaskom commented Nov 2, 2017

Note its also not working yet

details, details...

@dstansby
Copy link
Member

dstansby commented Nov 2, 2017

This definitely needs a test!

@jklymak jklymak changed the title Make tick_left/right keep labels off if they are already off WIP: Make tick_left/right keep labels off if they are already off Nov 2, 2017
@jklymak
Copy link
Member Author

jklymak commented Nov 2, 2017

@dstansby the test is easy if this is the behaviour we want.

@jklymak jklymak changed the title WIP: Make tick_left/right keep labels off if they are already off Make tick_left/right keep labels off if they are already off Nov 3, 2017
@jklymak jklymak added this to the v2.1.1 milestone Nov 3, 2017
Copy link
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

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

This looks reasonable as a fix for the regression. I suspect there is no perfect fix. The underlying problem is that our API is complicated and confusing, with too many ways to do some things, and a lack of clarity such as is illustrated by the original docstring 'use ticks only on top'.

@jklymak
Copy link
Member Author

jklymak commented Nov 8, 2017

@efiring Yeah, I would actually be in favour of deprecating these functions due to their ambiguity. This PR at least tries to document the ambiguity, but its suboptimal. OTOH, the set_tick_params is pretty clear, if more syntactically verbose.

@efiring
Copy link
Member

efiring commented Nov 8, 2017

Deprecation sounds good to me! It's hard to imagine that these vague shorthand versions are used so often in interactive mode, where their brevity would be most advantageous.

@tacaswell tacaswell merged commit c508c35 into matplotlib:master Nov 13, 2017
lumberbot-app bot pushed a commit that referenced this pull request Nov 13, 2017
dopplershift added a commit that referenced this pull request Nov 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change in behavior of axis.tick_left() with shared axes from 2.0 to 2.1
5 participants