diff --git a/lib/matplotlib/backends/backend_pgf.py b/lib/matplotlib/backends/backend_pgf.py index 60a47dc6126b..8a5769296910 100644 --- a/lib/matplotlib/backends/backend_pgf.py +++ b/lib/matplotlib/backends/backend_pgf.py @@ -478,7 +478,7 @@ def draw_path(self, gc, path, transform, rgbFace=None): # draw the path self._print_pgf_clip(gc) self._print_pgf_path_styles(gc, rgbFace) - self._print_pgf_path(gc, path, transform) + self._print_pgf_path(gc, path, transform, rgbFace) self._pgf_path_draw(stroke=gc.get_linewidth() != 0.0, fill=rgbFace is not None) writeln(self.fh, r"\end{pgfscope}") @@ -584,11 +584,11 @@ def _print_pgf_path_styles(self, gc, rgbFace): dash_str += r"}{%fpt}" % dash_offset writeln(self.fh, dash_str) - def _print_pgf_path(self, gc, path, transform): + def _print_pgf_path(self, gc, path, transform, rgbFace=None): f = 1. / self.dpi - # check for clip box + # check for clip box / ignore clip for filled paths bbox = gc.get_clip_rectangle() if gc else None - if bbox: + if bbox and (rgbFace is None): p1, p2 = bbox.get_points() clip = (p1[0], p1[1], p2[0], p2[1]) else: diff --git a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_pdflatex.pdf b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_pdflatex.pdf index 5a73f2ca920a..05d155b939c8 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_pdflatex.pdf and b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_pdflatex.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate1.pdf b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate1.pdf index 5d1082ad1b07..3728b59eaac2 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate1.pdf and b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate1.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate2.pdf b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate2.pdf index fa7c7e1c1b87..21cd4af4a942 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate2.pdf and b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_rcupdate2.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_xelatex.pdf b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_xelatex.pdf index 9f45fa87d2ad..6e7fa7bdb6aa 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_xelatex.pdf and b/lib/matplotlib/tests/baseline_images/test_backend_pgf/pgf_xelatex.pdf differ diff --git a/lib/matplotlib/tests/test_backend_pgf.py b/lib/matplotlib/tests/test_backend_pgf.py index 82833fbb6411..0cdd711e8df4 100644 --- a/lib/matplotlib/tests/test_backend_pgf.py +++ b/lib/matplotlib/tests/test_backend_pgf.py @@ -73,16 +73,28 @@ def compare_figure(fname, savefig_kwargs={}): def create_figure(): plt.figure() x = np.linspace(0, 1, 15) + + # line plot plt.plot(x, x ** 2, "b-") + + # marker + plt.plot(x, 1 - x**2, "g>") + + # filled paths and patterns plt.fill_between([0., .4], [.4, 0.], hatch='//', facecolor="lightgray", edgecolor="red") - plt.plot(x, 1 - x**2, "g>") + plt.fill([3, 3, .8, .8, 3], [2, -2, -2, 0, 2], "b") + + # text and typesetting plt.plot([0.9], [0.5], "ro", markersize=3) plt.text(0.9, 0.5, 'unicode (ü, °, µ) and math ($\\mu_i = x_i^2$)', ha='right', fontsize=20) plt.ylabel('sans-serif, blue, $\\frac{\\sqrt{x}}{y^2}$..', family='sans-serif', color='blue') + plt.xlim(0, 1) + plt.ylim(0, 1) + # test compiling a figure to pdf with xelatex @switch_backend('pgf')