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

Commit04232ab

Browse files
committed
Try restoring linewidth
1 parent27f171c commit04232ab

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

‎lib/matplotlib/backends/backend_pgf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,17 @@ def draw_path(self, gc, path, transform, rgbFace=None):
453453
r"{\pgfqpoint{0in}{0in}}{\pgfqpoint{1in}{1in}}")
454454
_writeln(self.fh,r"\pgfusepath{clip}")
455455
scale=mpl.transforms.Affine2D().scale(self.dpi)
456+
# Store default PGF line width
457+
_writeln(self.fh,r"\newlength{\defaultpgflinewidth}")
458+
_writeln(self.fh,
459+
r"\setlength{\defaultpgflinewidth}{\pgflinewidth}")
456460
lw= (mpl.rcParams["hatch.linewidth"]
457461
*mpl_pt_to_in*latex_in_to_pt)
458462
_writeln(self.fh,r"\pgfsetlinewidth{%fpt}"%lw)
459463
self._print_pgf_path(None,gc.get_hatch_path(),scale)
460464
self._pgf_path_draw(stroke=True)
465+
# Restore default PGF line width
466+
_writeln(self.fh,r"\pgfsetlinewidth{\defaultpgflinewidth}")
461467
_writeln(self.fh,r"\end{pgfscope}")
462468
_writeln(self.fh,r"}")
463469
# repeat pattern, filling the bounding rect of the path

‎lib/matplotlib/tests/test_backend_pgf.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99

1010
importmatplotlibasmpl
1111
importmatplotlib.pyplotasplt
12-
frommatplotlib.testingimport_has_tex_package,_check_for_pgf
13-
frommatplotlib.testing.compareimportcompare_images,ImageComparisonFailure
1412
frommatplotlib.backends.backend_pgfimportFigureCanvasPgf,PdfPages
13+
frommatplotlib.backends.backend_pdfimportFigureCanvasPdf
14+
frommatplotlib.testingimport_has_tex_package,_check_for_pgf
15+
frommatplotlib.testing.compareimportcompare_images
16+
frommatplotlib.testing.exceptionsimportImageComparisonFailure
1517
frommatplotlib.testing.decoratorsimport (
1618
_image_directories,check_figures_equal,image_comparison)
1719
frommatplotlib.testing._markersimport (
@@ -377,7 +379,6 @@ def test_sketch_params():
377379
assertbaselineinbuf
378380

379381

380-
<<<<<<<HEAD
381382
# test to make sure that the document font size is set consistently (see #26892)
382383
@needs_pgf_xelatex
383384
@pytest.mark.skipif(
@@ -400,13 +401,24 @@ def test_document_font_size():
400401
label=r'\normalsize the document font size is \the\fontdimen6\font'
401402
)
402403
plt.legend()
403-
=======
404+
405+
404406
@needs_pgf_xelatex
405407
@pytest.mark.backend('pgf')
406-
@image_comparison(['hatch_linewidth'],extensions=['pdf'])
407408
deftest_pgf_hatch_linewidth():
408409
mpl.backend_bases.register_backend('pdf',FigureCanvasPgf)
409410
mpl.rcParams['hatch.linewidth']=0.1
410411

411412
plt.bar(1,1,color='white',edgecolor='black',hatch='/')
412-
>>>>>>>7cbcd44f9a (FixhatchlinewidthinPGF)
413+
error=None
414+
try:
415+
compare_figure('hatch_linewidth.pdf')
416+
exceptImageComparisonFailurease:
417+
# Store if error
418+
error=e
419+
# Restore backend to not mess up other tests
420+
mpl.backend_bases.register_backend('pdf',FigureCanvasPdf)
421+
422+
iferrorisnotNone:
423+
# Re-raise stored error
424+
raiseerror

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp