Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bd79d5d

Browse filesBrowse files
authored
Merge pull request #20403 from tacaswell/noop_subplot_class_factory
FIX: if we have already subclassed mixin class just return
2 parents f4c518e + c39207d commit bd79d5d
Copy full SHA for bd79d5d

File tree

Expand file treeCollapse file tree

2 files changed

+10
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-0
lines changed

‎lib/matplotlib/cbook/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook/__init__.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,6 +2211,10 @@ def _make_class_factory(mixin_class, fmt, attr_name=None):
22112211

22122212
@functools.lru_cache(None)
22132213
def class_factory(axes_class):
2214+
# if we have already wrapped this class, declare victory!
2215+
if issubclass(axes_class, mixin_class):
2216+
return axes_class
2217+
22142218
# The parameter is named "axes_class" for backcompat but is really just
22152219
# a base class; no axes semantics are used.
22162220
base_class = axes_class

‎lib/matplotlib/tests/test_subplots.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_subplots.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import matplotlib.pyplot as plt
77
from matplotlib.testing.decorators import image_comparison
8+
import matplotlib.axes as maxes
89

910

1011
def check_shared(axs, x_shared, y_shared):
@@ -219,3 +220,8 @@ def test_dont_mutate_kwargs():
219220
gridspec_kw=gridspec_kw)
220221
assert subplot_kw == {'sharex': 'all'}
221222
assert gridspec_kw == {'width_ratios': [1, 2]}
223+
224+
225+
def test_subplot_factory_reapplication():
226+
assert maxes.subplot_class_factory(maxes.Axes) is maxes.Subplot
227+
assert maxes.subplot_class_factory(maxes.Subplot) is maxes.Subplot

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.