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 | # Standard library imports |
|
7 | # Standard library imports | |
2 | from cStringIO import StringIO |
|
8 | from cStringIO import StringIO | |
3 |
|
9 | |||
@@ -8,12 +14,14 b' from matplotlib._pylab_helpers import Gcf' | |||||
8 | # Local imports. |
|
14 | # Local imports. | |
9 | from backend_payload import add_plot_payload |
|
15 | from backend_payload import add_plot_payload | |
10 |
|
16 | |||
|
17 | #----------------------------------------------------------------------------- | |||
|
18 | # Functions | |||
|
19 | #----------------------------------------------------------------------------- | |||
11 |
|
20 | |||
12 | def show(): |
|
21 | def show(): | |
13 | """ Deliver a SVG payload. |
|
22 | """ Deliver a SVG payload. | |
14 | """ |
|
23 | """ | |
15 |
figure_manager |
|
24 | for figure_manager in Gcf.get_all_fig_managers(): | |
16 | if figure_manager is not None: |
|
|||
17 | # Make the background transparent. |
|
25 | # Make the background transparent. | |
18 | # figure_manager.canvas.figure.patch.set_alpha(0.0) |
|
26 | # figure_manager.canvas.figure.patch.set_alpha(0.0) | |
19 | # Set the background to white instead so it looks good on black. |
|
27 | # Set the background to white instead so it looks good on black. | |
@@ -22,6 +30,7 b' def show():' | |||||
22 | data = svg_from_canvas(figure_manager.canvas) |
|
30 | data = svg_from_canvas(figure_manager.canvas) | |
23 | add_plot_payload('svg', data) |
|
31 | add_plot_payload('svg', data) | |
24 |
|
32 | |||
|
33 | ||||
25 | def svg_from_canvas(canvas): |
|
34 | def svg_from_canvas(canvas): | |
26 | """ Return a string containing the SVG representation of a FigureCanvasSvg. |
|
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