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

Skip to content

Commit 71ba6ff

Browse files
committed
Merge pull request #4248 from pwuertz/fix_2885
FIX : backend_pgf: don't clip filled paths fixes #2885, fixes #3935, fixes #3693
2 parents d281296 + 3f80c70 commit 71ba6ff

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

lib/matplotlib/backends/backend_pgf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ def draw_path(self, gc, path, transform, rgbFace=None):
478478
# draw the path
479479
self._print_pgf_clip(gc)
480480
self._print_pgf_path_styles(gc, rgbFace)
481-
self._print_pgf_path(gc, path, transform)
481+
self._print_pgf_path(gc, path, transform, rgbFace)
482482
self._pgf_path_draw(stroke=gc.get_linewidth() != 0.0,
483483
fill=rgbFace is not None)
484484
writeln(self.fh, r"\end{pgfscope}")
@@ -584,11 +584,11 @@ def _print_pgf_path_styles(self, gc, rgbFace):
584584
dash_str += r"}{%fpt}" % dash_offset
585585
writeln(self.fh, dash_str)
586586

587-
def _print_pgf_path(self, gc, path, transform):
587+
def _print_pgf_path(self, gc, path, transform, rgbFace=None):
588588
f = 1. / self.dpi
589-
# check for clip box
589+
# check for clip box / ignore clip for filled paths
590590
bbox = gc.get_clip_rectangle() if gc else None
591-
if bbox:
591+
if bbox and (rgbFace is None):
592592
p1, p2 = bbox.get_points()
593593
clip = (p1[0], p1[1], p2[0], p2[1])
594594
else:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

lib/matplotlib/tests/test_backend_pgf.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,28 @@ def compare_figure(fname, savefig_kwargs={}):
7373
def create_figure():
7474
plt.figure()
7575
x = np.linspace(0, 1, 15)
76+
77+
# line plot
7678
plt.plot(x, x ** 2, "b-")
79+
80+
# marker
81+
plt.plot(x, 1 - x**2, "g>")
82+
83+
# filled paths and patterns
7784
plt.fill_between([0., .4], [.4, 0.], hatch='//', facecolor="lightgray",
7885
edgecolor="red")
79-
plt.plot(x, 1 - x**2, "g>")
86+
plt.fill([3, 3, .8, .8, 3], [2, -2, -2, 0, 2], "b")
87+
88+
# text and typesetting
8089
plt.plot([0.9], [0.5], "ro", markersize=3)
8190
plt.text(0.9, 0.5, 'unicode (ü, °, µ) and math ($\\mu_i = x_i^2$)',
8291
ha='right', fontsize=20)
8392
plt.ylabel('sans-serif, blue, $\\frac{\\sqrt{x}}{y^2}$..',
8493
family='sans-serif', color='blue')
8594

95+
plt.xlim(0, 1)
96+
plt.ylim(0, 1)
97+
8698

8799
# test compiling a figure to pdf with xelatex
88100
@switch_backend('pgf')

0 commit comments

Comments
 (0)