Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 7 commits into from
Apr 14, 2019

Conversation

tacaswell
Copy link
Member

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

@tacaswell tacaswell added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Apr 9, 2019
@tacaswell tacaswell added this to the v3.1.0 milestone Apr 9, 2019
@@ -754,6 +756,17 @@ def __init__(self, axes, pickradius=15):
majorTicks = _LazyTickList(major=True)
minorTicks = _LazyTickList(major=False)

def get_remove_overlapping_locs(self):
Copy link
Contributor

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?

Copy link
Contributor

@anntzer anntzer left a 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.

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.

Same reaction as Antony--getters and setters seem like overkill, but that's minor.

Copy link
Member

@ImportanceOfBeingErnest ImportanceOfBeingErnest left a 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?

@anntzer
Copy link
Contributor

anntzer commented Apr 9, 2019

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.

@jklymak
Copy link
Member

jklymak commented Apr 9, 2019

This looks fine to me. Definitely needs documentation somewhere...

@tacaswell
Copy link
Member Author

API changes notes are pushed to #13870 I don't think this needs a more prominent tutorial or example.

@tacaswell tacaswell marked this pull request as ready for review April 10, 2019 13:01
@tacaswell
Copy link
Member Author

(specifically 6cbbc85 )

@tacaswell tacaswell marked this pull request as ready for review April 10, 2019 14:12
@tacaswell
Copy link
Member Author

Not clear what is wrong with appeyor...

@anntzer
Copy link
Contributor

anntzer commented Apr 11, 2019

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.
@tacaswell tacaswell force-pushed the enh_control_tick_deconflict2 branch from 0ed8a8c to 0a6f575 Compare April 12, 2019 01:45
@tacaswell
Copy link
Member Author

rebased on current master and force-pushed, appveyor looks happier (it started!).

@jklymak
Copy link
Member

jklymak commented Apr 12, 2019

API changes notes are pushed to #13870 I don't think this needs a more prominent tutorial or example.

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

@tacaswell
Copy link
Member Author

Pushed a docs change.

@efiring efiring merged commit bbd10ba into matplotlib:master Apr 14, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Apr 14, 2019
@tacaswell tacaswell deleted the enh_control_tick_deconflict2 branch April 14, 2019 19:41
tacaswell added a commit that referenced this pull request Apr 14, 2019
…908-on-v3.1.x

Backport PR #13908 on branch v3.1.x (Enh control tick deconflict2)
tacaswell added a commit to tacaswell/matplotlib that referenced this pull request Apr 26, 2019
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`).
tacaswell added a commit to tacaswell/matplotlib that referenced this pull request Apr 26, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants