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
Locator interface #1064
Locator interface #1064
Conversation
Looks good. Maybe add a unit test and example of how to use this in the new way (without an Axes)? Not sure where that example should go -- it's non-visual (well, non-plot-producing) so it might be hard to find. |
'Return the locations of the ticks' | ||
return self.tick_values(None, None) | ||
|
||
def tick_values(self, vmin, vmax): |
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.
vmin -> dmin etc. for consistency
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.
For self consistency I would change all signatures in this module from dmin to vmin. Is there a consistency outside of this file which would make dmin
preferable?
I like this idea--I never liked the dummy axis. |
'Return the locations of the ticks' | ||
"""Return the locations of the ticks""" | ||
# note: some locators return data limits, other return view limits, | ||
# hence there is no *one* interface to call self.tick_values. |
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.
@efiring said:
Is there any reason not to remove most or all of the separate call definitions? It looks like they could be inherited from the base class.
Unfortunately some __call__
methods use self.axis.get_view_interval
others use self.axis.get_data_interval()
so I couldn't comfortably make that change.
Yes, I'd be happy to put in a unit test, but not sure a usage example would be that helpful/interesting. |
Ok. I've just added some tests for some of the Locators, but have not updated the "whats new" section as I am not sure such a menial thing is worthy of such exposure. Happy to make any further alterations though if either of you feel it is necessary. |
Will just rebase before it gets reviewed. |
The example I was thinking of would just be something to show how, given a range, one could get a list of ticks back. You've made it much easier than before, so we should show how easy it is... ;) |
Ok. changelog added. |
I have a need to get ticks for a given range, and the
matplotlib
Locator seemed like the perfect fit. Unfortunately, the Locator class needs an Axis to function (even if that Axis is aDummyAxis
instance).This PR makes it easy for some Locators to expose their underlying cleverness without the need for an Axis instance.