-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
added None option to _get_view, also fixed a typo #5108
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
Conversation
@@ -3340,7 +3341,10 @@ def _set_view_from_bbox(self, bbox, original_view, direction='in', | |||
|
|||
lastx, lasty, x, y = bbox | |||
|
|||
x0, y0, x1, y1 = original_view | |||
if(original_view is None): | |||
original_view = self._getview() |
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.
_get_view
, no?
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.
yes thanks! a typo for a typo :-\
@@ -3318,7 +3318,8 @@ def _set_view_from_bbox(self, bbox, original_view, direction='in', | |||
|
|||
original_view : any | |||
A view saved from before initiating the selection, the result of | |||
calling :meth:`_get_view`. | |||
calling :meth:`_get_view`. If set to none, _get_view will be called |
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.
Capitalize None. I would say "If None (default), _get_view will be called..."
On closer look, I can't see what this does? I can't see |
On 2015/09/20 2:19 PM, OceanWolf wrote:
I am, too. @QuLogic, why is original_view needed at all? Or is it |
You know, I think I agree with you as well, mostly. |
Sorry, this is my fault. I have updated the code (regarding the errors and fuzzy logic). I went back and copied and pasted what I originally had put in from my previous pull request. I was asked to move this modification to a new PR. |
Hey, no worries, glad to see you contributing, and no, the big issue I have here (and still have) comes from the code already in master, namely that we have code here that does nothing (and you tweak code that does nothing, so...). With team projects such as this, everyone becomes responsible for the code, with everyone able to take a look and review code. We do it as a team effort. So yes, the dead code. If you look below, x0,and x1; and y0 and y1 get set at the top of each |
Yes I agree, it wasn't your fault @ordirules; In fact, that's where the swapped |
thanks yeah, good catch. I've made the change. :-) |
@ordirules I think you still need to update the callers of @tacaswell: Since this is a cleanup of an API being added to 1.5, I think it should still try to target 1.5 so people don't use the old one. Admittedly, the API is a private one, though. |
There are two uses which are now broken:
Fine with this going in for 1.5.0 |
ok will make the change. I honestly prefer the latter and would re-write the functions as (while it still has not been used): Okay to change? @QuLogic @OceanWolf (and any other expert in this one) |
Since we are already in RC mode, let's keep it private for now. I say, go On Tue, Sep 29, 2015 at 9:27 AM, Julien Lhermitte notifications@github.com
|
yes. prefixing with underscore means private, but... of course python doesn't care so much about that, the rule of thumb with accessing private members from outside goes along the lines of:
|
I like the plan of keeping the private for a while before making them public. |
No, absolutely not; we are not making that assumption at all. The view is an opaque
It is private because the public should not use it, not because other parts of matplotlib can't. |
Thanks for the clarification about the preceding underscore (I assumed the convention was to use it to restrict its use to the class). @QuLogic thanks for clarifying this. I assumed that since it is possible to change the view with a bbox that there is a one-to-one correspondence between the two. However, I have thought of it and this correspondence is broken if the function ignores the bbox for example, or if there are axes that have voids within the bbox (i.e. what does it mean when selection is in that void), many crazy examples... This patch is straightforward and is ready for review. However, I am thinking ahead for the zooming after this and would like to take the opportunity to quickly discuss (if you have time). I think we can incorporate it just fine by simply adding an extra rule to the _set_view_from_bbox function: I have thought of a few scenarios and this is the best fix I can think of. It moves the zooming behaviour to the axes and does not add a new function to the axes (which already have quite a lot). The zoom history can easily be managed to the new get_view and set_view functionalities within the toolbar. I think this integrates quite nicely. It's a trade off of the loss of explicitness for verbosity in my opinion where I'm going for the former. |
@ordirules @QuLogic Thanks! |
This pull request contains two modifications:
x0,y0 should be x0,x1