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

Commite392b59

Browse files
authored
Merge pull request#28468 from meeseeksmachine/auto-backport-of-pr-28465-on-v3.9.x
Backport PR#28465 on branch v3.9.x (Fix pickling of SubFigures)
2 parents1f0e4c4 +14711fa commite392b59

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

‎lib/matplotlib/figure.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2224,7 +2224,6 @@ def __init__(self, parent, subplotspec, *,
22242224
self.subplotpars=parent.subplotpars
22252225
self.dpi_scale_trans=parent.dpi_scale_trans
22262226
self._axobservers=parent._axobservers
2227-
self.canvas=parent.canvas
22282227
self.transFigure=parent.transFigure
22292228
self.bbox_relative=Bbox.null()
22302229
self._redo_transform_rel_fig()
@@ -2241,6 +2240,10 @@ def __init__(self, parent, subplotspec, *,
22412240
self._set_artist_props(self.patch)
22422241
self.patch.set_antialiased(False)
22432242

2243+
@property
2244+
defcanvas(self):
2245+
returnself._parent.canvas
2246+
22442247
@property
22452248
defdpi(self):
22462249
returnself._parent.dpi

‎lib/matplotlib/figure.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ class SubFigure(FigureBase):
263263
figure:Figure
264264
subplotpars:SubplotParams
265265
dpi_scale_trans:Affine2D
266-
canvas:FigureCanvasBase
267266
transFigure:Transform
268267
bbox_relative:Bbox
269268
figbbox:BboxBase
@@ -282,6 +281,8 @@ class SubFigure(FigureBase):
282281
**kwargs
283282
)->None: ...
284283
@property
284+
defcanvas(self)->FigureCanvasBase: ...
285+
@property
285286
defdpi(self)->float: ...
286287
@dpi.setter
287288
defdpi(self,value:float)->None: ...

‎lib/matplotlib/tests/test_pickle.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ def _generate_complete_test_figure(fig_ref):
9393
plt.errorbar(x,x*-0.5,xerr=0.2,yerr=0.4,label='$-.5 x$')
9494
plt.legend(draggable=True)
9595

96+
# Ensure subfigure parenting works.
97+
subfigs=fig_ref.subfigures(2)
98+
subfigs[0].subplots(1,2)
99+
subfigs[1].subplots(1,2)
100+
96101
fig_ref.align_ylabels()# Test handling of _align_label_groups Groupers.
97102

98103

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp