File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -788,6 +788,19 @@ class Grouper:
788
788
def __init__ (self , init = ()):
789
789
self ._mapping = {weakref .ref (x ): [weakref .ref (x )] for x in init }
790
790
791
+ def __getstate__ (self ):
792
+ return {
793
+ ** vars (self ),
794
+ # Convert weak refs to strong ones.
795
+ "_mapping" : {k (): [v () for v in vs ] for k , vs in self ._mapping .items ()},
796
+ }
797
+
798
+ def __setstate__ (self , state ):
799
+ vars (self ).update (state )
800
+ # Convert strong refs to weak ones.
801
+ self ._mapping = {weakref .ref (k ): [* map (weakref .ref , vs )]
802
+ for k , vs in self ._mapping .items ()}
803
+
791
804
def __contains__ (self , item ):
792
805
return weakref .ref (item ) in self ._mapping
793
806
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ def _generate_complete_test_figure(fig_ref):
59
59
# Ensure lists also pickle correctly.
60
60
plt .subplot (3 , 3 , 1 )
61
61
plt .plot (list (range (10 )))
62
+ plt .ylabel ("hello" )
62
63
63
64
plt .subplot (3 , 3 , 2 )
64
65
plt .contourf (data , hatches = ['//' , 'ooo' ])
@@ -69,6 +70,7 @@ def _generate_complete_test_figure(fig_ref):
69
70
70
71
plt .subplot (3 , 3 , 4 )
71
72
plt .imshow (data )
73
+ plt .ylabel ("hello\n world!" )
72
74
73
75
plt .subplot (3 , 3 , 5 )
74
76
plt .pcolor (data )
@@ -91,6 +93,8 @@ def _generate_complete_test_figure(fig_ref):
91
93
plt .errorbar (x , x * - 0.5 , xerr = 0.2 , yerr = 0.4 )
92
94
plt .legend (draggable = True )
93
95
96
+ fig_ref .align_ylabels () # Test handling of _align_label_groups Groupers.
97
+
94
98
95
99
@mpl .style .context ("default" )
96
100
@check_figures_equal (extensions = ["png" ])
You can’t perform that action at this time.
0 commit comments