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

Skip to content

Commit 6295929

Browse files
committed
MNT: raise when silently dropping user input
1 parent 5a92cb0 commit 6295929

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/matplotlib/figure.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2754,6 +2754,9 @@ def add_gridspec(self, nrows, ncols, **kwargs):
27542754
"""
27552755

27562756
_ = kwargs.pop('figure', None) # pop in case user has added this...
2757+
if _ and _ is not self:
2758+
raise ValueError(f"you passed the figure {_} which is going to"
2759+
"be over-ridden by this method with self")
27572760
gs = GridSpec(nrows=nrows, ncols=ncols, figure=self, **kwargs)
27582761
self._gridspecs.append(gs)
27592762
return gs

0 commit comments

Comments
 (0)