10000 FIX: Reset CL counter for each new figure · matplotlib/matplotlib@476b101 · GitHub
[go: up one dir, main page]

Skip to content

Commit 476b101

Browse files
committed
FIX: Reset CL counter for each new figure
1 parent c20b0c2 commit 476b101

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/matplotlib/_layoutbox.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def get_renderer(fig):
4444

4545
return renderer
4646

47+
len_seq = 6 # number of digints in unique id. See seq_id below...
4748

4849
class LayoutBox(object):
4950
"""
@@ -354,7 +355,9 @@ def _is_subplotspec_layoutbox(self):
354355
Helper to check if this layoutbox is the layoutbox of a
355356
subplotspec
356357
'''
357-
name = (self.name).split('.')[-1][:-3]
358+
global len_seq
359+
360+
name = (self.name).split('.')[-1][:-len_seq]
358361
if name == 'ss':
359362
return True
360363
return False
@@ -364,7 +367,9 @@ def _is_gridspec_layoutbox(self):
364367
Helper to check if this layoutbox is the layoutbox of a
365368
gridspec
366369
'''
367-
name = (self.name).split('.')[-1][:-3]
370+
global len_seq
371+
372+
name = (self.name).split('.')[-1][:-len_seq]
368373
if name == 'gridspec':
369374
return True
370375
return False
@@ -645,8 +650,10 @@ def seq_id():
645650
'''
646651

647652
global _layoutboxobjnum
653+
global len_seq
648654

649-
return ('%03d' % (next(_layoutboxobjnum)))
655+
fstr = '%0{}d'.format(len_seq)
656+
return (fstr%(next(_layoutboxobjnum)))
650657

651658

652659
def print_children(lb):

0 commit comments

Comments
 (0)
0