Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a19a38

Browse files
committed
Scale params to match existing appearance
1 parent d3ad76f commit 4a19a38

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
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

0 commit comments

Comments
 (0)