Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit88f23d3

Browse files
authored
Merge pull request#20404 from tacaswell/auto-backport-of-pr-20403-on-v3.4.x
2 parentsbc6cb1b +e1206cc commit88f23d3

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

‎lib/matplotlib/axes/_subplots.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,18 @@ def subplot_class_factory(axes_class=None):
175175
"is deprecated since %(since)s; explicitly pass the default Axes "
176176
"class instead. This will become an error %(removal)s.")
177177
axes_class=Axes
178+
178179
try:
179180
# Avoid creating two different instances of GeoAxesSubplot...
180181
# Only a temporary backcompat fix. This should be removed in
181182
# 3.4
182183
returnnext(clsforclsinSubplotBase.__subclasses__()
183184
ifcls.__bases__== (SubplotBase,axes_class))
184185
exceptStopIteration:
186+
# if we have already wrapped this class, declare victory!
187+
ifissubclass(axes_class,SubplotBase):
188+
returnaxes_class
189+
185190
returntype("%sSubplot"%axes_class.__name__,
186191
(SubplotBase,axes_class),
187192
{'_axes_class':axes_class})

‎lib/matplotlib/tests/test_subplots.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
importmatplotlib.pyplotasplt
77
frommatplotlib.testing.decoratorsimportimage_comparison
8+
importmatplotlib.axesasmaxes
89

910

1011
defcheck_shared(axs,x_shared,y_shared):
@@ -195,3 +196,8 @@ def test_dont_mutate_kwargs():
195196
gridspec_kw=gridspec_kw)
196197
assertsubplot_kw== {'sharex':'all'}
197198
assertgridspec_kw== {'width_ratios': [1,2]}
199+
200+
201+
deftest_subplot_factory_reapplication():
202+
assertmaxes.subplot_class_factory(maxes.Axes)ismaxes.Subplot
203+
assertmaxes.subplot_class_factory(maxes.Subplot)ismaxes.Subplot

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp