Skip to content

Commit db343c3

Browse files
committed
fix the stack remove error
1 parent 987199c commit db343c3

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎lib/matplotlib/figure.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ def add(self, key, a):
125125
except TypeError:
126126
raise ValueError("first argument, %s, is not a valid key" % key)
127127

128-
a_existing = self.get(key)
128+
a_existing = dict(self._elements).get(key)
129129
if a_existing is not None:
130130
Stack.remove(self, (key, a_existing))
131131
warnings.warn(
132-
"key %s already existed; Axes is being replaced" % key)
132+
"key %s already existed; Axes is being replaced" % str(key))
133133
# I don't think the above should ever happen.
134134

135135
if a in self:
@@ -362,7 +362,7 @@ def _repr_html_(self):
362362
# We can't use "isinstance" here, because then we'd end up importing
363363
# webagg unconditiionally.
364364
if (self.canvas is not None and
365-
'WebAgg' in self.canvas.__class__.__name__):
365+
'WebAgg' in self.canvas.__class__.__name__):
366366
from matplotlib.backends import backend_webagg
367367
return backend_webagg.ipython_inline_display(self)
368368

@@ -816,7 +816,7 @@ def _make_key(self, *args, **kwargs):
816816
'make a hashable key out of args and kwargs'
817817

818818
def fixitems(items):
819-
#items may have arrays and lists in them, so convert them
819+
# items may have arrays and lists in them, so convert them
820820
# to tuples for the key
821821
ret = []
822822
for k, v in items:
@@ -1745,7 +1745,7 @@ def subplots_adjust(self, *args, **kwargs):
17451745
if not isinstance(ax, SubplotBase):
17461746
# Check if sharing a subplots axis
17471747
if (ax._sharex is not None and
1748-
isinstance(ax._sharex, SubplotBase)):
1748+
isinstance(ax._sharex, SubplotBase)):
17491749
ax._sharex.update_params()
17501750
ax.set_position(ax._sharex.figbox)
17511751
elif (ax._sharey is not None and
@@ -1921,8 +1921,8 @@ def figaspect(arg):
19211921
# could become rc parameters, for now they're hardwired.
19221922
figsize_min = np.array((4.0, 2.0)) # min length for width/height
19231923
figsize_max = np.array((16.0, 16.0)) # max length for width/height
1924-
#figsize_min = rcParams['figure.figsize_min']
1925-
#figsize_max = rcParams['figure.figsize_max']
1924+
# figsize_min = rcParams['figure.figsize_min']
1925+
# figsize_max = rcParams['figure.figsize_max']
19261926

19271927
# Extract the aspect ratio of the array
19281928
if isarray:

0 commit comments

Comments
 (0)