Skip to content

Commit 08d1aa6

Browse files
committed
Scale params to match existing appearance
1 parent d3ad76f commit 08d1aa6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/matplotlib/backends/backend_pgf.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,13 +611,16 @@ def _print_pgf_path(self, gc, path, transform, rgbFace=None):
611611
# -> Use "randomness" as PRNG seed to allow the user to force the
612612
# same shape on multiple sketched lines
613613
scale, length, randomness = sketch_params
614+
# make PGF output visually similar to matplotlib's sketched lines
615+
adjustment_a = 0.5
616+
adjustment_b = 2
614617
if scale is not None:
615618
# PGF guarantees that repeated loading is a no-op
616619
writeln(self.fh, r"\usepgfmodule{decorations}")
617620
writeln(self.fh, r"\usepgflibrary{decorations.pathmorphing}")
618621
writeln(self.fh, r"\pgfkeys{/pgf/decoration/.cd, "
619-
f"segment length = {(length * f):f}in, "
620-
f"amplitude = {(scale * f):f}in}}")
622+
f"segment length = {(length * f * adjustment_a):f}in, "
623+
f"amplitude = {(scale * f * adjustment_b):f}in}}")
621624
writeln(self.fh, f"\\pgfmathsetseed{{{int(randomness)}}}")
622625
writeln(self.fh, r"\pgfdecoratecurrentpath{random steps}")
623626

lib/matplotlib/tests/test_backend_pgf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def test_sketch_params():
357357
\usepgfmodule{decorations}%
358358
\usepgflibrary{decorations.pathmorphing}%
359359
\pgfkeys{/pgf/decoration/.cd, """ \
360-
r"""segment length = 0.300000in, amplitude = 0.050000in}%
360+
r"""segment length = 0.150000in, amplitude = 0.100000in}%
361361
\pgfmathsetseed{42}%
362362
\pgfdecoratecurrentpath{random steps}%
363363
\pgfusepath{stroke}%"""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy