File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -10,16 +10,16 @@ def test_obj_comparison():
10
10
from matplotlib .axes import Subplot , Axes
11
11
import matplotlib
12
12
13
- mpl_version = tuple (int (v ) for v in matplotlib .__version__ .split ("." ))
13
+ mpl_version = tuple (int (v ) for v in matplotlib .__version__ .split ("." )[: 2 ] )
14
14
15
15
view_class1 = view_wrapper (Subplot )
16
16
view_class2 = view_wrapper (Subplot )
17
17
view_class3 = view_wrapper (Axes )
18
18
19
19
assert view_class1 is view_class2
20
20
assert view_class1 == view_class2
21
- if (mpl_version >= (3 , 7 , 0 )):
22
- # As of 3.7.0, the subplot class no long exists, and is an alias to the Axes class...
21
+ if (mpl_version >= (3 , 7 )):
22
+ # As of 3.7.0, the subplot class no longer exists, and is an alias to the Axes class...
23
23
assert view_class2 == view_class3
24
24
else :
25
25
assert view_class2 != view_class3
Original file line number Diff line number Diff line change 4
4
5
5
def figure_to_image (figure ):
6
6
figure .canvas .draw ()
7
- img = np .frombuffer (figure .canvas .tostring_rgb (), dtype = np .uint8 )
8
- return img .reshape (figure .canvas .get_width_height ()[::- 1 ] + (3 ,))
7
+ img = np .frombuffer (figure .canvas .buffer_rgba (), dtype = np .uint8 )
8
+ return img .reshape (figure .canvas .get_width_height ()[::- 1 ] + (4 ,))[..., : 3 ]
9
9
10
10
11
11
def matches_post_pickle (figure ):
You can’t perform that action at this time.
0 commit comments