Skip to content

Fixed ZoomPanBase to work with log plots #4970

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 6 commits into from
Nov 3, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
document typo fix and added warning for set_view_from_bbox
  • Loading branch information
jrmlhermitte committed Oct 17, 2015
commit 9ed8c7d70c7e4dc015a2d79decfc87e0de007ef7
8 changes: 6 additions & 2 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3322,7 +3322,7 @@ def _set_view_from_bbox(self, bbox, direction='in',
Parameters
----------

bbox : 4-tuple or 2 tuple
bbox : 4-tuple or 3 tuple
* If result is a 4 tuple, it is the selected bounding box limits,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be bbox, not result?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep thanks for the catch

in *display* coordinates.
* If result is a 3 tuple, it is an (xp, yp, scl) triple, where
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Expand Down Expand Up @@ -3352,7 +3352,6 @@ def _set_view_from_bbox(self, bbox, direction='in',
if(len(bbox) == 3):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary parentheses (plus various cases below.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. thanks.

# Zooming code
xp, yp, scl = bbox
print("in set view, for zooming with scale {}".format(scl))

# Should not happen
if(scl == 0):
Expand Down Expand Up @@ -3380,6 +3379,11 @@ def _set_view_from_bbox(self, bbox, direction='in',

bbox = [xzc - xwidth/2./scl, yzc - ywidth/2./scl, xzc +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes more sense to break after the comma, not the addition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good idea thanks, shouldn't trust my blind vim linewrap :-D

xwidth/2./scl, yzc + ywidth/2./scl]
elif(len(bbox) != 4):
# should be len 3 or 4 but nothing else
print("Warning in _set_view_from_bbox: bounding box is not a
tuple of length 3 or\ 4. Ignoring the view change...\n");
return

# Just grab bounding box
lastx, lasty, x, y = bbox
Expand Down