tellurium.plotting package¶
Submodules¶
tellurium.plotting.api module¶
- tellurium.plotting.api.plot(x, y, show=True, **kwargs)[source]¶
Create a 2D scatter plot.
- Parameters:
x – A numpy array describing the X datapoints. Should have the same number of rows as y.
y – A numpy array describing the Y datapoints. Should have the same number of rows as x.
tag – A tag so that all traces of the same type are plotted using same color/label (for e.g. multiple stochastic traces).
tags – Like tag, but for multiple traces.
name – The name of the trace.
label – The name of the trace.
names – Like name, but for multiple traces to appear in the legend.
labels – The name of the trace.
alpha – Floating point representing the opacity ranging from 0 (transparent) to 1 (opaque).
show – show=True (default) shows the plot, use show=False to plot multiple simulations in one plot
showlegend – Whether to show the legend or not.
mode – Can be set to ‘markers’ to generate scatter plots, or ‘dash’ for dashed lines.
import numpy as np, tellurium as te result = np.array([[1,2,3,4], [7.2,6.5,8.8,10.5], [9.8, 6.5, 4.3,3.0]]) te.plot(result[:,0], result[:,1], name='Second column', show=False) te.plot(result[:,0], result[:,2], name='Third column', show=False) te.show(reset=False) # does not reset the plot after showing plot te.plot(result[:,0], result[:,3], name='Fourth column', show=False) te.show()
tellurium.plotting.engine module¶
Defines the main classes for plotting which are implemented by the different ploting frameworks, i.e. matplotlib or plotly.
- class tellurium.plotting.engine.LowerTriFigure[source]¶
Bases:
TiledFigure
- class tellurium.plotting.engine.PlottingEngine[source]¶
Bases:
object
Abstract parent class of all PlottingEngines.
Helper functions on this class provide methods to create new figures from various datasets.
- accumulateTimecourse(m, xlabel=None, ylabel=None, title=None, linewidth=2, xlim=None, ylim=None, logx=False, logy=False, xscale='linear', yscale='linear', grid=False, ordinates=None, tag=None, labels=None, figsize=(6, 4), savefig=None, dpi=80, alpha=1.0, **kwargs)[source]¶
Accumulates the traces instead of plotting (like matplotlib with show=False). Call show() to show the plot.
- Parameters:
m – An array returned by RoadRunner.simulate.
- figureFromTimecourse(m, ordinates=None, tag=None, alpha=None, title=None, xlim=None, ylim=None, **kwargs)[source]¶
Generate a new figure from a timecourse simulation.
- Parameters:
m – An array returned by RoadRunner.simulate.
- Returns:
instance of PlottingFigure
- figureFromXY(x, y, **kwargs)[source]¶
Generate a new figure from x/y data.
- Parameters:
x – A column representing x data.
y – Y data (may be multiple columns).
- Returns:
instance of PlottingFigure
- abstract newFigure(title=None, logX=False, logY=False, layout=None, xlabel=None, ylabel=None, xlim=None, ylim=None)[source]¶
Returns PlottingFigure. Needs to be implemented in base class.
- abstract newTiledFigure(title=None, logX=False, logY=False, layout=None, xlabel=None, ylabel=None)[source]¶
Returns PlottingTiledFigure. Needs to be implemented in base class.
- plot(x, y, show=True, **kwargs)[source]¶
Plot x & y data.
- Parameters:
x – x data.
y – y data (can be multiple columns).
- Returns:
instance of PlottingFigure
- plotTimecourse(m, xlabel=None, ylabel=None, title=None, linewidth=2, xlim=None, ylim=None, logx=False, logy=False, xscale='linear', yscale='linear', grid=False, ordinates=None, tag=None, labels=None, figsize=(6, 4), savefig=None, dpi=80, alpha=1.0, **kwargs)[source]¶
Plots a timecourse from a simulation.
- Parameters:
m – An array returned by RoadRunner.simulate.
- class tellurium.plotting.engine.PlottingFigure(title=None, layout=<tellurium.plotting.engine.PlottingLayout object>, logx=False, xlabel=None, logy=False, ylabel=None, selections=None)[source]¶
Bases:
object
- addXYDataset(x_arr, y_arr, color=None, tag=None, name=None, filter=True, alpha=None, mode=None, logx=None, logy=None, scatter=None, error_y_pos=None, error_y_neg=None, showlegend=None, text=None, dash=None, linewidth=None, marker=None, mec=None, mfc=None, ms=None, mew=None, edgecolor=None, bottom=None, bartype=None, y2=None)[source]¶
Adds an X/Y dataset to the plot.
- Parameters:
x_arr – A numpy array describing the X datapoints. Should have the same size as y_arr.
y_arr – A numpy array describing the Y datapoints. Should have the same size as x_arr.
color – The color to use (not supported by all backends).
tag – A tag so that all traces of the same type are plotted consistently (for e.g. multiple stochastic traces).
name – The name of the trace.
filter – Apply the self.selections filter?
alpha – Floating point representing the opacity.
mode – Either ‘lines’ or ‘markers’ (defaults to ‘lines’).
- plot(x, y, colnames=None, title=None, xlabel=None, logx=None, logy=None, ylabel=None, alpha=None, name=None, names=None, tag=None, tags=None, scatter=None, error_y_pos=None, error_y_neg=None, showlegend=None, label=None, labels=None, text=None, dash=None, color=None)[source]¶
Plot x & y data.
- tellurium.plotting.engine.filterWithSelections(self, name, selections)[source]¶
This function is intended to be used as an argument to the filter built-in. It filters out unwanted traces (only those variables specified in selections will be passed through).
- Parameters:
name – The symbol we want to potentially filter
selections – The list of selections we want to plot
tellurium.plotting.engine_mpl module¶
Matplotlib implementation of the plotting engine.
- class tellurium.plotting.engine_mpl.MatplotlibEngine[source]¶
Bases:
PlottingEngine
Matplotlib engine.
- class tellurium.plotting.engine_mpl.MatplotlibFigure(layout=<tellurium.plotting.engine.PlottingLayout object>, use_legend=True, xlabel=None, ylabel=None, title=None, linewidth=None, xlim=None, ylim=None, logx=None, logy=None, xscale=None, yscale=None, grid=None, ordinates=None, tag=None, labels=None, figsize=(9, 6), savefig=None, dpi=None)[source]¶
Bases:
PlottingFigure
MatplotlibFigure.
tellurium.plotting.engine_null module¶
Plotly implementation of the plotting engine.
- class tellurium.plotting.engine_null.NullEngine[source]¶
Bases:
PlottingEngine
PlottingEngine using plotly.
- class tellurium.plotting.engine_null.NullFigure(title=None, layout=<tellurium.plotting.engine.PlottingLayout object>, logx=False, logy=False, save_to_pdf=False, xlabel=None, ylabel=None)[source]¶
Bases:
PlottingFigure
PlotlyFigure.
- class tellurium.plotting.engine_null.PlotlyLowerTriFigure(engine, rows, cols)[source]¶
Bases:
PlotlyTiledFigure
,LowerTriFigure
tellurium.plotting.engine_plotly module¶
Plotly implementation of the plotting engine.
- class tellurium.plotting.engine_plotly.PlotlyEngine[source]¶
Bases:
PlottingEngine
PlottingEngine using plotly.
- newFigure(title=None, logX=False, logY=False, layout=<tellurium.plotting.engine.PlottingLayout object>, xlabel=None, ylabel=None)[source]¶
Returns a figure object.
- class tellurium.plotting.engine_plotly.PlotlyFigure(title=None, layout=<tellurium.plotting.engine.PlottingLayout object>, logx=False, logy=False, save_to_pdf=False, xlabel=None, ylabel=None)[source]¶
Bases:
PlottingFigure
PlotlyFigure.
- class tellurium.plotting.engine_plotly.PlotlyLowerTriFigure(engine, rows, cols)[source]¶
Bases:
PlotlyTiledFigure
,LowerTriFigure
- class tellurium.plotting.engine_plotly.PlotlyStackedFigure(title=None, layout=<tellurium.plotting.engine.PlottingLayout object>, logx=False, logy=False)[source]¶
Bases:
PlotlyFigure
Stacked figure.
tellurium.plotting.factory module¶
Factory for the engines.