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

Skip to content

Commit c553f8c

Browse files
committed
ENH: keep track of added grispecs
1 parent 11958f3 commit c553f8c

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
@@ -393,6 +393,9 @@ def __init__(self,
393393
self._align_xlabel_grp = cbook.Grouper()
394394
self._align_ylabel_grp = cbook.Grouper()
395395

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

23122315
_ = kwargs.pop('figure', None) # pop in case user has added this...
2313-
return GridSpec(nrows=nrows, ncols=ncols, figure=self, **kwargs)
2316+
gs = GridSpec(nrows=nrows, ncols=ncols, figure=self, **kwargs)
2317+
self._gridspecs.append(gs)
2318+
return gs
23142319

23152320

23162321
def figaspect(arg):

0 commit comments

Comments
 (0)