MCPcopy Index your code
hub / github.com/plotly/plotly.py / Exporter

Class Exporter

plotly/matplotlylib/mplexporter/exporter.py:17–317  ·  view source on GitHub ↗

Matplotlib Exporter Parameters ---------- renderer : Renderer object The renderer object called by the exporter to create a figure visualization. See mplexporter.Renderer for information on the methods which should be defined within the renderer. close_mpl :

Source from the content-addressed store, hash-verified

15
16
17class Exporter(object):
18 """Matplotlib Exporter
19
20 Parameters
21 ----------
22 renderer : Renderer object
23 The renderer object called by the exporter to create a figure
24 visualization. See mplexporter.Renderer for information on the
25 methods which should be defined within the renderer.
26 close_mpl : bool
27 If True (default), close the matplotlib figure as it is rendered. This
28 is useful for when the exporter is used within the notebook, or with
29 an interactive matplotlib backend.
30 """
31
32 def __init__(self, renderer, close_mpl=True):
33 self.close_mpl = close_mpl
34 self.renderer = renderer
35
36 def run(self, fig):
37 """
38 Run the exporter on the given figure
39
40 Parmeters
41 ---------
42 fig : matplotlib.Figure instance
43 The figure to export
44 """
45 # Calling savefig executes the draw() command, putting elements
46 # in the correct place.
47 if fig.canvas is None:
48 FigureCanvasAgg(fig)
49 fig.savefig(io.BytesIO(), format="png", dpi=fig.dpi)
50 if self.close_mpl:
51 import matplotlib.pyplot as plt
52
53 plt.close(fig)
54 self.crawl_fig(fig)
55
56 @staticmethod
57 def process_transform(
58 transform, ax=None, data=None, return_trans=False, force_trans=None
59 ):
60 """Process the transform and convert data to figure or data coordinates
61
62 Parameters
63 ----------
64 transform : matplotlib Transform object
65 The transform applied to the data
66 ax : matplotlib Axes object (optional)
67 The axes the data is associated with
68 data : ndarray (optional)
69 The array of data to be transformed.
70 return_trans : bool (optional)
71 If true, return the final transform of the data
72 force_trans : matplotlib.transform instance (optional)
73 If supplied, first force the data to this transform
74

Callers 5

run_figFunction · 0.90
fig_to_vincentFunction · 0.85
fig_to_vegaFunction · 0.85
fake_renderer_outputFunction · 0.85

Calls

no outgoing calls

Tested by 2

fake_renderer_outputFunction · 0.68