Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit08d1aa6

Browse files
committed
Scale params to match existing appearance
1 parentd3ad76f commit08d1aa6

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
ifscaleisnotNone:
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)

[8]ページ先頭

©2009-2025 Movatter.jp