MCPcopy Create free account
hub / github.com/ScottfreeLLC/AlphaPy / write_plot

Function write_plot

alphapy/plots.py:211–283  ·  view source on GitHub ↗

r"""Save the plot to a file, or display it interactively. Parameters ---------- vizlib : str The visualization library: ``'matplotlib'``, ``'seaborn'``, or ``'bokeh'``. plot : module Plotting context, e.g., ``plt``. plot_type : str Type of plot to

(vizlib, plot, plot_type, tag, directory=None)

Source from the content-addressed store, hash-verified

209#
210
211def write_plot(vizlib, plot, plot_type, tag, directory=None):
212 r"""Save the plot to a file, or display it interactively.
213
214 Parameters
215 ----------
216 vizlib : str
217 The visualization library: ``'matplotlib'``, ``'seaborn'``,
218 or ``'bokeh'``.
219 plot : module
220 Plotting context, e.g., ``plt``.
221 plot_type : str
222 Type of plot to generate.
223 tag : str
224 Unique identifier for the plot.
225 directory : str, optional
226 The full specification for the directory location. if
227 ``directory`` is *None*, then the plot is displayed
228 interactively.
229
230 Returns
231 -------
232 None : None.
233
234 Raises
235 ------
236 ValueError
237 Unrecognized data visualization library.
238
239 References
240 ----------
241
242 Visualization Libraries:
243
244 * Matplotlib : http://matplotlib.org/
245 * Seaborn : https://seaborn.pydata.org/
246 * Bokeh : http://bokeh.pydata.org/en/latest/
247
248 """
249
250 # Validate visualization library
251
252 if (vizlib == 'matplotlib' or
253 vizlib == 'seaborn' or
254 vizlib == 'bokeh'):
255 # supported library
256 pass
257 elif vizlib == 'plotly':
258 raise ValueError("Unsupported data visualization library: %s" % vizlib)
259 else:
260 raise ValueError("Unrecognized data visualization library: %s" % vizlib)
261
262 # Save or display the plot
263
264 if directory:
265 if vizlib == 'bokeh':
266 file_only = ''.join([plot_type, USEP, tag, '.html'])
267 else:
268 file_only = ''.join([plot_type, USEP, tag, '.png'])

Callers 15

plot_calibrationFunction · 0.85
plot_importanceFunction · 0.85
plot_learning_curveFunction · 0.85
plot_roc_curveFunction · 0.85
plot_confusion_matrixFunction · 0.85
plot_validation_curveFunction · 0.85
plot_boundaryFunction · 0.85
plot_partial_dependenceFunction · 0.85
plot_scatterFunction · 0.85
plot_facet_gridFunction · 0.85
plot_distributionFunction · 0.85
plot_boxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected