experimentum.Plots package¶
Submodules¶
experimentum.Plots.Factory module¶
Factory to load and init plot classes.
-
class
experimentum.Plots.Factory.
Factory
(app)¶ Bases:
object
Create instances of plot classes based on their name.
-
create
(name)¶ Create a new plot class instance.
Parameters: name (str) – Name of the plot. Returns: Plot Class Return type: AbstractPlot
-
parse
(plot)¶ Parse the config file for the current plot.
Parameters: plot (str) – Name of the plot. Returns: Config data for the plot Return type: object
-
experimentum.Plots.Plot module¶
Interface and Implementation for generating plots and charts.
The default implementation of AbstractPlot
is the
Plot
class which internally uses the matplotlib library
to generate the plots. If you want to use another library to generate
your plots you can add a new CustomPlot class which implements the
AbstractPlot
interface. Now your plots need to inherit
from your CustomPlot class and you are good to go.
-
class
experimentum.Plots.Plot.
AbstractPlot
(repo, config, plot_type=u'plot')¶ Bases:
object
Abstract Interface for a plot class.
Parameters: - repo (AbstractRepository) – Repository Class to fetch data.
- config (Config) – Config data for the plot.
- plot_type (str, optional) – Defaults to ‘plot’. Type of plot
- plot (object) – Plotting library
-
data
(experiments)¶ Return Data for the plot.
Parameters: experiments (AbstractRepository) – Repository with current experiment Returns: x,y,z values or list of x,y,z coordinates (e.g. {‘x’: 0, ‘y’: 0, ‘z’: 0}) Return type: list|dict
-
draw
(data, plot_idx=None)¶ Draw the plot data.
Parameters: - data (dict) – Dictionary with coordinates (e.g. {‘x’: 0, ‘y’: 0, ‘z’: 0})
- plot_idx (integer, optional) – Defaults to None. Index for when multiple plots are drawn
Raises: NotImplementedError – Must implement draw method
-
labeling
()¶ Add labels to the plot.
Raises: NotImplementedError – Must implement labeling method
-
plotting
()¶ Generate the plot, i.e. add labels, titles, legend etc and draw the plot.
Returns: Plot object Return type: object Raises: NotImplementedError – Must implement plotting method
-
save
(filename)¶ Save the plot.
Parameters: filename (str) – Filename to save the plot. Raises: NotImplementedError – Must implement save method
-
show
()¶ Show the plot.
Raises: NotImplementedError – Must implement show method
-
class
experimentum.Plots.Plot.
Plot
(repo, config, plot_type=u'plot')¶ Bases:
experimentum.Plots.Plot.AbstractPlot
Concrete Implementation of the AbstractPlot Interface for a plot class.
This implementation uses matplotlib to genereate the plots.
Parameters: - repo (AbstractRepository) – Repository Class to fetch data.
- config (Config) – Config data for the plot.
- plot_type (str, optional) – Defaults to ‘plot’. Type of plot
- plot (matplotlib.pyplot) – matplotlib.pyplot module
-
draw
(data, plot_idx=None)¶ Draw the plot data.
Parameters: - data (dict) – Dictionary with coordinates (e.g. {‘x’: 0, ‘y’: 0, ‘z’: 0})
- plot_idx (integer, optional) – Defaults to None. Index for when multiple plots are drawn
-
labeling
()¶ Add labels to the plot.
-
plotting
()¶ Generate the plot, i.e. add labels, titles, legend etc and draw the plot.
Returns: Plot object Return type: matplotlib.pyplot
-
save
(filename)¶ Save the plot.
Parameters: filename (str) – Filename to save the plot.
-
show
()¶ Show the plot.
Module contents¶
Package for generating plots and charts.