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 @@ -58,6 +58,7 @@ def _generate_complete_test_figure(fig_ref):
58
58
# Ensure lists also pickle correctly.
59
59
plt .subplot (3 , 3 , 1 )
60
60
plt .plot (list (range (10 )))
61
+ plt .ylabel ("hello" )
61
62
62
63
plt .subplot (3 , 3 , 2 )
63
64
plt .contourf (data , hatches = ['//' , 'ooo' ])
@@ -68,6 +69,7 @@ def _generate_complete_test_figure(fig_ref):
68
69
69
70
plt .subplot (3 , 3 , 4 )
70
71
plt .imshow (data )
72
+ plt .ylabel ("hello\n world!" )
71
73
72
74
plt .subplot (3 , 3 , 5 )
73
75
plt .pcolor (data )
@@ -89,6 +91,8 @@ def _generate_complete_test_figure(fig_ref):
89
91
plt .subplot (3 , 3 , 9 )
90
92
plt .errorbar (x , x * - 0.5 , xerr = 0.2 , yerr = 0.4 )
91
93
94
+ fig_ref .align_ylabels () # Test handling of _align_label_groups Groupers.
95
+
92
96
93
97
@mpl .style .context ("default" )
94
98
@check_figures_equal (extensions = ["png" ])
You can’t perform that action at this time.
0 commit comments