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

Make tick_left/right keep labels off if they are already off by jklymak · Pull Request #9670 · matplotlib/matplotlib · GitHub

Repository navigation

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

Merged
tacaswell merged 5 commits into
matplotlib:masterfrom
jklymak:fixtickleft
Nov 13, 2017
Merged

tacaswell merged 5 commits into
matplotlib:masterfrom
jklymak:fixtickleft

Conversation

jklymak commented Nov 2, 2017 •
edited
Loading

Copy link
Copy Markdown
Member

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 commented Nov 2, 2017

Copy link
Copy Markdown

Does this address the corresponding changes in tick_bottom/tick_top?

jklymak commented Nov 2, 2017

Copy link
Copy Markdown
Member Author

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

Note its also not working yet

mwaskom commented Nov 2, 2017

Copy link
Copy Markdown

Note its also not working yet

details, details...

dstansby commented Nov 2, 2017

Copy link
Copy Markdown
Member

This definitely needs a test!

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 commented Nov 2, 2017

Copy link
Copy Markdown
Member Author

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

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 added this to the v2.1.1 milestone Nov 3, 2017

efiring left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 commented Nov 8, 2017

Copy link
Copy Markdown
Member Author

@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 commented Nov 8, 2017

Copy link
Copy Markdown
Member

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

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


Back | FazBrowse Home | New Git URL