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

Commit02fde42

Browse files
committed
Make sure SubFigure have _cachedRenderer
1 parentd73ba9e commit02fde42

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

‎lib/matplotlib/figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ def __init__(self, **kwargs):
188188
self.subfigs= []
189189
self.stale=True
190190
self.suppressComposite=None
191+
self._cachedRenderer=None
191192
self.set(**kwargs)
192193

193194
def_get_draw_artists(self,renderer):
@@ -2360,7 +2361,6 @@ def __init__(self,
23602361

23612362
self._axstack=_AxesStack()# track all figure axes and current axes
23622363
self.clear()
2363-
self._cachedRenderer=None
23642364

23652365
# list of child gridspecs for this figure
23662366
self._gridspecs= []

‎lib/matplotlib/tests/test_contour.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,3 +585,23 @@ def test_all_algorithms():
585585
ax.contourf(x,y,z,algorithm=algorithm)
586586
ax.contour(x,y,z,algorithm=algorithm,colors='k')
587587
ax.set_title(algorithm)
588+
589+
590+
deftest_subfigure_clabel():
591+
# Smoke test for gh#23173
592+
delta=0.025
593+
x=np.arange(-3.0,3.0,delta)
594+
y=np.arange(-2.0,2.0,delta)
595+
X,Y=np.meshgrid(x,y)
596+
Z1=np.exp(-(X**2)-Y**2)
597+
Z2=np.exp(-((X-1)**2)- (Y-1)**2)
598+
Z= (Z1-Z2)*2
599+
600+
fig=plt.figure()
601+
figs=fig.subfigures(nrows=1,ncols=2)
602+
603+
forfinfigs:
604+
ax=f.subplots()
605+
CS=ax.contour(X,Y,Z)
606+
ax.clabel(CS,inline=True,fontsize=10)
607+
ax.set_title("Simplest default with labels")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp