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

Should scale changes respect previously explicitly set tickers and formatters? #18572

Open
anntzer opened this issue Sep 25, 2020 · 3 comments
Open

Comments

@anntzer
Copy link
Contributor

anntzer commented Sep 25, 2020

Bug report

Bug summary

Units (e.g. datetime) and scales (e.g. log) both come with their own default locators (various DateLocators, LogLocator) and formatters (various DateFormatters, LogFormatter), which are being set in Axis._update_axisinfo and Axis.set_scale, respectively.

If a locator or formatter has already been manually set on the axis, then setting units will not override the user-set locator/formatter -- this is tracked using the slighly awkwardly named isDefault_{maj,min}{loc,fmt}. On the other hand, setting a scale will override locator/formatters previously set.

Code for reproduction

from pylab import *

subplot(121)
xticks([])
xscale("log")

subplot(122)
xticks([])
plot_date([1, 2], [3, 4])

show()

Actual outcome

test

Expected outcome

Consistent behavior between the two cases. #18571 (comment) is one where scales also respecting user-set locators/formatters would be nice, but I can also see an argument for the opposite behavior for simplicity...

Matplotlib version

  • Operating system: linux
  • Matplotlib version: HEAD
  • Matplotlib backend (print(matplotlib.get_backend())): any
  • Python version: 38
  • Jupyter version (if applicable):
  • Other libraries:
@timhoffm
Copy link
Member

timhoffm commented Nov 6, 2020

API-wise, each of the solutions is generally ok.

It would be more user-friendly to notify of the incompatibility rather than silently overwritng. If we can do that in a consistent way without too much effort, I'd lean that way.

@anntzer
Copy link
Contributor Author

anntzer commented Nov 6, 2020

We could warn, but that actually seems rather obnoxious; if I write e.g. ax.set_xticks([...]); ax.set_xscale("log") (where set_xticks sets a FixedFormatter), it's clear that that's I've set the ticks I want, and adding a warning in set_xscale asking to call set_xticks after set_xscale is just annoying (in particular that would also warn when changing scales interactively with the l key, for example).

@github-actions
Copy link

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Aug 21, 2023
@anntzer anntzer added keep Items to be ignored by the “Stale” Github Action and removed status: inactive Marked by the “Stale” Github Action labels Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants