##// END OF EJS Templates
Fix svg rich backend to correctly show multiple figures.
Fernando Perez -
Show More
@@ -1,3 +1,9 b''
1 """Produce SVG versions of active plots for display by the rich Qt frontend.
2 """
3 #-----------------------------------------------------------------------------
4 # Imports
5 #-----------------------------------------------------------------------------
6
1 7 # Standard library imports
2 8 from cStringIO import StringIO
3 9
@@ -8,12 +14,14 b' from matplotlib._pylab_helpers import Gcf'
8 14 # Local imports.
9 15 from backend_payload import add_plot_payload
10 16
17 #-----------------------------------------------------------------------------
18 # Functions
19 #-----------------------------------------------------------------------------
11 20
12 21 def show():
13 22 """ Deliver a SVG payload.
14 23 """
15 figure_manager = Gcf.get_active()
16 if figure_manager is not None:
24 for figure_manager in Gcf.get_all_fig_managers():
17 25 # Make the background transparent.
18 26 # figure_manager.canvas.figure.patch.set_alpha(0.0)
19 27 # Set the background to white instead so it looks good on black.
@@ -22,6 +30,7 b' def show():'
22 30 data = svg_from_canvas(figure_manager.canvas)
23 31 add_plot_payload('svg', data)
24 32
33
25 34 def svg_from_canvas(canvas):
26 35 """ Return a string containing the SVG representation of a FigureCanvasSvg.
27 36 """
General Comments 0
You need to be logged in to leave comments. Login now