@@ -182,17 +182,28 @@ circle: plotting a circle using a `matplotlib.patches.Circle` patch
182
182
vs plotting the circle using the parametric equation of a circle ::
183
183
184
184
from matplotlib.testing.decorators import check_figures_equal
185
- import matplotib .patches as mpatches
185
+ import matplotlib .patches as mpatches
186
186
import matplotlib.pyplot as plt
187
187
import numpy as np
188
188
189
- @check_figures_equal(extensions=['png'], tol=100 )
189
+ @check_figures_equal()
190
190
def test_parametric_circle_plot(fig_test, fig_ref):
191
- red_circle_ref = mpatches.Circle((0, 0), 0.2, color='r', clip_on=False)
192
- fig_ref.add_artist(red_circle_ref)
193
- theta = np.linspace(0, 2 * np.pi, 150)
191
+
192
+ xo, yo= (.5, .5)
194
193
radius = 0.4
195
- fig_test.plot(radius * np.cos(theta), radius * np.sin(theta), color='r')
194
+
195
+ ax_test = fig_test.subplots()
196
+ theta = np.linspace(0, 2 * np.pi, 150)
197
+ l, = ax_test.plot(xo + (radius * np.cos(theta)),
198
+ yo + (radius * np.sin(theta)), c='r')
199
+
200
+ ax_ref = fig_ref.subplots()
201
+ red_circle_ref = mpatches.Circle((xo, yo), radius, ec='r', fc='none',
202
+ lw=l.get_linewidth())
203
+ ax_ref.add_artist(red_circle_ref)
204
+
205
+ for ax in [ax_ref, ax_test]:
206
+ ax.set(xlim=(0,1), ylim=(0,1), aspect='equal')
196
207
197
208
Both comparison decorators have a tolerance argument ``tol `` that is used to specify the
198
209
tolerance for difference in color value between the two images, where 255 is the maximal
0 commit comments