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

Function test_sketch_params

lib/matplotlib/tests/test_backend_pgf.py:395–418  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

393
394@pytest.mark.backend("pgf")
395def test_sketch_params():
396 fig, ax = plt.subplots(figsize=(3, 3))
397 ax.set_xticks([])
398 ax.set_yticks([])
399 ax.set_frame_on(False)
400 handle, = ax.plot([0, 1])
401 handle.set_sketch_params(scale=5, length=30, randomness=42)
402
403 with BytesIO() as fd:
404 fig.savefig(fd, format='pgf')
405 buf = fd.getvalue().decode()
406
407 baseline = r"""\pgfpathmoveto{\pgfqpoint{0.375000in}{0.300000in}}%
408\pgfpathlineto{\pgfqpoint{2.700000in}{2.700000in}}%
409\usepgfmodule{decorations}%
410\usepgflibrary{decorations.pathmorphing}%
411\pgfkeys{/pgf/decoration/.cd, """ \
412 r"""segment length = 0.150000in, amplitude = 0.100000in}%
413\pgfmathsetseed{42}%
414\pgfdecoratecurrentpath{random steps}%
415\pgfusepath{stroke}%"""
416 # \pgfdecoratecurrentpath must be after the path definition and before the
417 # path is used (\pgfusepath)
418 assert baseline in buf
419
420
421# test to make sure that the document font size is set consistently (see #26892)

Callers

nothing calls this directly

Calls 7

set_xticksMethod · 0.80
set_yticksMethod · 0.80
subplotsMethod · 0.45
set_frame_onMethod · 0.45
plotMethod · 0.45
set_sketch_paramsMethod · 0.45
savefigMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…