MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_sine_plus_noise

Function test_sine_plus_noise

lib/matplotlib/tests/test_simplification.py:218–233  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

216
217
218def test_sine_plus_noise():
219 np.random.seed(0)
220 x = (np.sin(np.linspace(0, np.pi * 2.0, 50000)) +
221 np.random.uniform(size=50000) * 0.01)
222
223 fig, ax = plt.subplots()
224 p1 = ax.plot(x, solid_joinstyle='round', linewidth=2.0)
225
226 # Ensure that the path's transform takes the new axes limits into account.
227 fig.canvas.draw()
228 path = p1[0].get_path()
229 transform = p1[0].get_transform()
230 path = transform.transform_path(path)
231 simplified = path.cleaned(simplify=True)
232
233 assert simplified.vertices.size == 25240
234
235
236@image_comparison(['simplify_curve'], remove_text=True, style='_classic_test',

Callers

nothing calls this directly

Calls 7

cleanedMethod · 0.80
subplotsMethod · 0.45
plotMethod · 0.45
drawMethod · 0.45
get_pathMethod · 0.45
get_transformMethod · 0.45
transform_pathMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…