-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Enh control tick deconflict2 #13908
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
Enh control tick deconflict2 #13908
Conversation
@@ -754,6 +756,17 @@ def __init__(self, axes, pickradius=15): | |||
majorTicks = _LazyTickList(major=True) | |||
minorTicks = _LazyTickList(major=False) | |||
|
|||
def get_remove_overlapping_locs(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we decided not to bother with getter and setters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved modulo one minor comment; I think putting the attribute on the Axis is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same reaction as Antony--getters and setters seem like overkill, but that's minor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I currently cannot think of a reason not to use the flag on the axis instead of the locator. In turn, a clear benefit is that major locators do not need to carry a useless (confusing) attribute with them. So this solution seems good to me.
I could imagine that if people are using this they might want to have an rc parameter for it, but one can sure wait for user feedback first.
Concerning getters/setters, maybe it's beneficial to have something like
ax.xaxis.set(minor_locator=MultipleLocator(30), remove_overlapping_locs=False)
working as expected? This would require there to be a set_remove_overlapping_locs
method, right?
I indeed missed the fact that this now lives on an Artist subclass and therefore the setter is useful to play nicely with Artist.set, so I'm fine with keeping it. |
This looks fine to me. Definitely needs documentation somewhere... |
API changes notes are pushed to #13870 I don't think this needs a more prominent tutorial or example. |
(specifically 6cbbc85 ) |
Not clear what is wrong with appeyor... |
rebase and push? |
In matplotlib#13363 when `iter_ticks` was deprecated the in-lined logic did not account for the updates from matplotlib#13314.
If Axis.remove_overlapping_locs is set to False the `Axis` object will not attempt to remove locations in the minor ticker that overlap with locations in the major ticker. This is a follow up to matplotlib#13314 which un-conditionally removed the overlap. closes matplotlib#13618
This will make sure extra ticks (that will not be used) will not be returned. The change to `get_major_ticks` is a no-op, but done for symmetry.
This is to prevent user confusion if they are reaching directly into `Axis.minorTicks` and `Axis.majorTicks` and see ticks report they are visible but are not actually drawn.
0ed8a8c
to
0a6f575
Compare
rebased on current master and force-pushed, appveyor looks happier (it started!). |
OK, but so far as I can see this has no documentation at all except for the API note? https://20198-1385122-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/api/axis_api.html#axis-objects |
Pushed a docs change. |
…908-on-v3.1.x Backport PR #13908 on branch v3.1.x (Enh control tick deconflict2)
This reverts part of the changes from matplotlib#13908 (in particular commit e908efe ) that tried to manage the visibility if the ticks that are not used. However, there was a bug in this that nothing would ever set ticks to be visible again. Because we currently cache / recycle ticks this meant that panning / zooming or resizing the figure would eventually lose ticks if the number of ticks ever went down and then back up. We could fix this by adding a `tick.set_visible(True)` for the drawn ticks, however this would break the (brittle) use case where users are reaching in and manually setting the visibility of individual ticks to False to hide them. Instead, we revert the consistency code altogether and accept that there will be `Tick` objects in `Axis.majorTicks` and `Axis.minorTicks` that are marked as visible, but are not drawn (because they are filtered by `_update_ticks`).
This reverts part of the changes from matplotlib#13908 (in particular commit e908efe ) that tried to manage the visibility if the ticks that are not used. However, there was a bug in this that nothing would ever set ticks to be visible again. Because we currently cache / recycle ticks this meant that panning / zooming or resizing the figure would eventually lose ticks if the number of ticks ever went down and then back up. We could fix this by adding a `tick.set_visible(True)` for the drawn ticks, however this would break the (brittle) use case where users are reaching in and manually setting the visibility of individual ticks to False to hide them. Instead, we revert the consistency code altogether and accept that there will be `Tick` objects in `Axis.majorTicks` and `Axis.minorTicks` that are marked as visible, but are not drawn (because they are filtered by `_update_ticks`). Closes matplotlib#14054
This is an alternative to #13826 that puts the knob on the
Axis
rather than the locator.I have a memory of talking about doing this and deciding not to, but do not remember why.
attn @efiring