From d1350994591d32c51fc2673e1a22fe8670ec6e4b Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Thu, 1 Nov 2012 09:56:06 -0400 Subject: [PATCH] Save and restore state around the PDF backend path collection draw. Fixes #1444 --- lib/matplotlib/backends/backend_pdf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/matplotlib/backends/backend_pdf.py b/lib/matplotlib/backends/backend_pdf.py index 37da2cda868c..22174ee67c82 100644 --- a/lib/matplotlib/backends/backend_pdf.py +++ b/lib/matplotlib/backends/backend_pdf.py @@ -7,6 +7,7 @@ from __future__ import division, print_function import codecs +import copy import os import re import sys @@ -1534,6 +1535,7 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms, path_codes.append(name) output = self.file.output + gc = copy.copy(self.gc) output(Op.gsave) lastx, lasty = 0, 0 for xo, yo, path_id, gc0, rgbFace in self._iter_collection( @@ -1546,6 +1548,7 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms, output(1, 0, 0, 1, dx, dy, Op.concat_matrix, path_id, Op.use_xobject) lastx, lasty = xo, yo output(Op.grestore) + self.gc = gc def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None): # For simple paths or small numbers of markers, don't bother