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

Skip to content

Commit 4a64f3d

Browse files
committed
ENH: keep track of added grispecs
1 parent 2d337ac commit 4a64f3d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/figure.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,9 @@ def __init__(self,
392392
self._align_xlabel_grp = cbook.Grouper()
393393
self._align_ylabel_grp = cbook.Grouper()
394394

395+
# list of child gridspecs for this figure
396+
self._gridspecs = []
397+
395398
# TODO: I'd like to dynamically add the _repr_html_ method
396399
# to the figure in the right context, but then IPython doesn't
397400
# use it, for some reason.
@@ -2298,7 +2301,9 @@ def add_gridspec(self, nrows, ncols, **kwargs):
22982301
"""
22992302

23002303
_ = kwargs.pop('figure', None) # pop in case user has added this...
2301-
return GridSpec(nrows=nrows, ncols=ncols, figure=self, **kwargs)
2304+
gs = GridSpec(nrows=nrows, ncols=ncols, figure=self, **kwargs)
2305+
self._gridspecs.append(gs)
2306+
return gs
23022307

23032308

23042309
def figaspect(arg):

0 commit comments

Comments
 (0)