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

Skip to content

Commit d7b7522

Browse files
authored
Merge pull request #7783 from samsontmr/fix-#7487
Raise exception if negative height or width is passed to axes()
2 parents c676432 + 9926b05 commit d7b7522

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,8 @@ def __init__(self, fig, rect,
483483
self._position = rect
484484
else:
485485
self._position = mtransforms.Bbox.from_bounds(*rect)
486+
if self._position.width < 0 or self._position.height < 0:
487+
raise ValueError('Width and height specified must be non-negative')
486488
self._originalPosition = self._position.frozen()
487489
# self.set_axes(self)
488490
self.axes = self

0 commit comments

Comments
 (0)