Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to export properly to svg and pdf with interactive paths #2005

Merged
merged 1 commit into from May 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/matplotlib/axes.py
Expand Up @@ -2014,8 +2014,11 @@ def draw(self, renderer=None, inframe=False):
if self.axison and self._frameon:
artists.extend(self.spines.itervalues())

dsu = [ (a.zorder, a) for a in artists
if not a.get_animated() ]
if self.figure.canvas.is_saving():
dsu = [(a.zorder, a) for a in artists]
else:
dsu = [(a.zorder, a) for a in artists
if not a.get_animated()]

# add images to dsu if the backend support compositing.
# otherwise, does the manaul compositing without adding images to dsu.
Expand Down
11 changes: 11 additions & 0 deletions lib/matplotlib/backend_bases.py
Expand Up @@ -1485,13 +1485,21 @@ def __init__(self, figure):
self.scroll_pick_id = self.mpl_connect('scroll_event',self.pick)
self.mouse_grabber = None # the axes currently grabbing mouse
self.toolbar = None # NavigationToolbar2 will set me
self._is_saving = False
if False:
## highlight the artists that are hit
self.mpl_connect('motion_notify_event',self.onHilite)
## delete the artists that are clicked on
#self.mpl_disconnect(self.button_pick_id)
#self.mpl_connect('button_press_event',self.onRemove)

def is_saving(self):
"""
Returns `True` when the renderer is in the process of saving
to a file, rather than rendering for an on-screen buffer.
"""
return self._is_saving

def onRemove(self, ev):
"""
Mouse event processor which removes the top artist
Expand Down Expand Up @@ -2096,6 +2104,7 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
else:
_bbox_inches_restore = None

self._is_saving = True
try:
#result = getattr(self, method_name)(
result = print_method(
Expand All @@ -2114,6 +2123,7 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
self.figure.set_facecolor(origfacecolor)
self.figure.set_edgecolor(origedgecolor)
self.figure.set_canvas(self)
self._is_saving = False
#self.figure.canvas.draw() ## seems superfluous
return result

Expand Down Expand Up @@ -2160,6 +2170,7 @@ def switch_backends(self, FigureCanvasClass):
figure size or line props), will be reflected in the other
"""
newCanvas = FigureCanvasClass(self.figure)
newCanvas._is_saving = self._is_saving
return newCanvas

def mpl_connect(self, s, func):
Expand Down