Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Raise exception if negative height or width is passed to axes() #7783

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 1 commit into from
Jan 11, 2017

Conversation

samsontmr
Copy link
Contributor

Fixes #7487

@@ -483,6 +483,9 @@ def __init__(self, fig, rect,
self._position = rect
else:
self._position = mtransforms.Bbox.from_bounds(*rect)
x0, y0, x1, y1 = self._position.extents
if ((x1 - x0) < 0 or (y1 - y0) < 0):
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use self._position.width < 0 or self._position.height < 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tip!

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Jan 10, 2017
@@ -483,6 +483,8 @@ def __init__(self, fig, rect,
self._position = rect
else:
self._position = mtransforms.Bbox.from_bounds(*rect)
if self._position.width < 0 or self._position.height < 0:
raise ValueError('Height and width specified must be non-negative')
Copy link
Contributor

Choose a reason for hiding this comment

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

Very minor point: probably "Width and height must be non-negative" is better (as the order is x, y). I wouldn't add "specified" but I'll let a native speaker chime in :p

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a native speaker ;p

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine, the point about order still remains valid :p

Copy link
Contributor

Choose a reason for hiding this comment

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

(I would suggest squashing the commits too.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it!

@samsontmr
Copy link
Contributor Author

Commits squashed!

@codecov-io
Copy link

codecov-io commented Jan 11, 2017

Current coverage is 62.11% (diff: 50.00%)

Merging #7783 into master will decrease coverage by <.01%

@@             master      #7783   diff @@
==========================================
  Files           174        174          
  Lines         56028      56030     +2   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits          34805      34804     -1   
- Misses        21223      21226     +3   
  Partials          0          0          

Powered by Codecov. Last update d181f63...9926b05

@anntzer
Copy link
Contributor

anntzer commented Jan 11, 2017

LGTM.

@anntzer anntzer changed the title Raise exception if negative height or width is passed to axes() [MRG+1] Raise exception if negative height or width is passed to axes() Jan 11, 2017
Copy link
Contributor

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the contribution! 🎉

@dopplershift dopplershift merged commit d7b7522 into matplotlib:master Jan 11, 2017
@dopplershift dopplershift changed the title [MRG+1] Raise exception if negative height or width is passed to axes() Raise exception if negative height or width is passed to axes() Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.