@@ -84,3 +84,40 @@ def test_poly_marker(fig_test, fig_ref):
84
84
85
85
ax_test .set (xlim = (- 0.5 , 5.5 ), ylim = (- 0.5 , 5.5 ))
86
86
ax_ref .set (xlim = (- 0.5 , 5.5 ), ylim = (- 0.5 , 5.5 ))
87
+
88
+
89
+ # The asterisk marker is really a star with 0-size inner circle, so the ends
90
+ # are corners and get a slight bevel. The reference markers are just singular
91
+ # lines without corners, so they have no bevel, and we need to add a slight
92
+ # tolerance.
93
+ @check_figures_equal (tol = 1.45 )
94
+ def test_asterisk_marker (fig_test , fig_ref , request ):
95
+ ax_test = fig_test .add_subplot ()
96
+ ax_ref = fig_ref .add_subplot ()
97
+
98
+ # Note, some reference sizes must be different because they have unit
99
+ # *length*, while asterisk markers are inscribed in a circle of unit
100
+ # *radius*. This introduces a factor of np.sqrt(2), but since size is
101
+ # squared, that becomes 2.
102
+ size = 20 ** 2
103
+
104
+ def draw_ref_marker (y , style , size ):
105
+ # As noted above, every line is doubled. Due to antialiasing, these
106
+ # doubled lines make a slight difference in the .png results.
107
+ ax_ref .scatter ([y ], [y ], marker = UnsnappedMarkerStyle (style ), s = size )
108
+ if request .getfixturevalue ('ext' ) == 'png' :
109
+ ax_ref .scatter ([y ], [y ], marker = UnsnappedMarkerStyle (style ),
110
+ s = size )
111
+
112
+ # Plus
113
+ ax_test .scatter ([0 ], [0 ], marker = (4 , 2 ), s = size )
114
+ draw_ref_marker (0 , '+' , size )
115
+ ax_test .scatter ([0.5 ], [0.5 ], marker = (4 , 2 , 0 ), s = size )
116
+ draw_ref_marker (0.5 , '+' , size )
117
+
118
+ # Cross
119
+ ax_test .scatter ([1 ], [1 ], marker = (4 , 2 , 45 ), s = size )
120
+ draw_ref_marker (1 , 'x' , size / 2 )
121
+
122
+ ax_test .set (xlim = (- 0.5 , 1.5 ), ylim = (- 0.5 , 1.5 ))
123
+ ax_ref .set (xlim = (- 0.5 , 1.5 ), ylim = (- 0.5 , 1.5 ))
0 commit comments