Skip to content

Commit 07375a0

Browse files
committed
Fix unshare None.
1 parent 3cc9213 commit 07375a0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4265,20 +4265,23 @@ def _unshare_axes(self, axes, shared_axes):
42654265
getattr(axes, "{}axis".format(shared_axes)))
42664266
except KeyError:
42674267
pass
4268+
return
42684269

42694270
if axes is None:
4271+
for ax in shared:
4272+
if ax is self:
4273+
continue
4274+
getattr(ax, "_shared_{}_inv_axes".format(
4275+
shared_axes)).remove(self)
4276+
42704277
shared.clear()
42714278
shared.add(self)
42724279
axes = self
42734280

42744281
if axes is self:
42754282
shared = getattr(self, "_shared_{}_inv_axes".format(shared_axes))
42764283
for ax in shared:
4277-
shared_ax = getattr(ax, "_shared_{}_axes".format(shared_axes))
4278-
try:
4279-
shared_ax.remove(self)
4280-
except KeyError:
4281-
pass
4284+
getattr(ax, "_shared_{}_axes".format(shared_axes)).remove(self)
42824285

42834286
shared.clear()
42844287
self._copy_axis_major_minor(

0 commit comments

Comments
 (0)