@@ -1151,12 +1151,40 @@ def test_check_masked_offsets():
11511151 ax .scatter (unmasked_x , masked_y )
11521152
11531153
1154- def test_masked_set_offsets ():
1154+ @check_figures_equal (extensions = ["png" ])
1155+ def test_masked_set_offsets (fig_ref , fig_test ):
1156+ x = np .ma .array ([1 , 2 , 3 , 4 , 5 ], mask = [0 , 0 , 1 , 1 , 0 ])
1157+ y = np .arange (1 , 6 )
1158+
1159+ ax_test = fig_test .add_subplot ()
1160+ scat = ax_test .scatter (x , y )
1161+ x += 1
1162+ scat .set_offsets (np .ma .column_stack ([x , y ]))
1163+ ax_test .set_xticks ([])
1164+ ax_test .set_yticks ([])
1165+ ax_test .set_xlim (0 , 7 )
1166+ ax_test .set_ylim (0 , 6 )
1167+
1168+ ax_ref = fig_ref .add_subplot ()
1169+ ax_ref .scatter ([2 , 3 , 6 ], [1 , 2 , 5 ])
1170+ ax_ref .set_xticks ([])
1171+ ax_ref .set_yticks ([])
1172+ ax_ref .set_xlim (0 , 7 )
1173+ ax_ref .set_ylim (0 , 6 )
1174+
1175+
1176+ def test_check_offsets_dtype ():
1177+ # Check that setting offsets doesn't change dtype
11551178 x = np .ma .array ([1 , 2 , 3 , 4 , 5 ], mask = [0 , 0 , 1 , 1 , 0 ])
11561179 y = np .arange (1 , 6 )
11571180
11581181 fig , ax = plt .subplots ()
11591182 scat = ax .scatter (x , y )
11601183 x += 1
1161- scat .set_offsets (np .ma .column_stack ([x , y ]))
1162- assert np .ma .is_masked (scat .get_offsets ())
1184+ masked_offsets = np .ma .column_stack ([x , y ])
1185+ scat .set_offsets (masked_offsets )
1186+ assert isinstance (scat .get_offsets (), type (masked_offsets ))
1187+
1188+ unmasked_offsets = np .column_stack ([x , y ])
1189+ scat .set_offsets (unmasked_offsets )
1190+ assert isinstance (scat .get_offsets (), type (unmasked_offsets ))
0 commit comments