sbmlsim.plot.plotting
¶
Classes for storing plotting information.
The general workflow of generating plotting information is the following.
- Within simulation experiments abstract plotting information is stored.
i.e., how from the data plots can be generated.
Working with multidimensional data ! Additional settings are required which allow to define how things
are plotted. E.g. over which dimensions should an error be calculated and which dimensions should be plotted individually.
Module Contents¶
Classes¶
Base class for plotting objects. |
|
LineType options. |
|
MarkerType options. |
|
CurveType options. |
|
ColorType class. |
|
Style of a line. |
|
Style of a marker. |
|
Style of a fill. |
|
Style class. |
|
Scale of the axis. |
|
Position of yaxis. |
|
Axis object. |
|
Base class of Curves and ShadedAreas. |
|
Curve object. |
|
ShadedArea class. |
|
Plot panel. |
|
A SubPlot holds a plot in a Figure. |
|
A figure consists of multiple subplots. |
Attributes¶
- sbmlsim.plot.plotting.DEFAULT_COLORS = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f',...[source]¶
- class sbmlsim.plot.plotting.BasePlotObject(sid, name)[source]¶
Base class for plotting objects.
- Parameters:
sid (str) –
name (str) –
- class sbmlsim.plot.plotting.ColorType(color)[source]¶
ColorType class.
Encoding color information used in plots.
- Parameters:
color (str) –
- class sbmlsim.plot.plotting.Marker[source]¶
Style of a marker.
- type: MarkerType[source]¶
- class sbmlsim.plot.plotting.Style(sid=None, name=None, base_style=None, line=None, marker=None, fill=None)[source]¶
Bases:
BasePlotObject
Style class.
Storing styling informatin about line, marker and fill. Styles can be derived from other styles based on the the base_style attribute.
- Parameters:
- resolve_style()[source]¶
Resolve all basestyle information.
Resolves the actual style information.
- Return type:
- to_mpl_points_kwargs()[source]¶
Convert to matplotlib point curve keyword arguments.
- Return type:
Dict[str, Any]
- class sbmlsim.plot.plotting.Axis(label=None, unit=None, name=None, scale=AxisScale.LINEAR, min=None, max=None, reverse=False, grid=False, label_visible=True, ticks_visible=True, style=None)[source]¶
Bases:
BasePlotObject
Axis object.
- Parameters:
- class sbmlsim.plot.plotting.AbstractCurve(sid, name, x=None, order=None, style=None, yaxis_position=None)[source]¶
Bases:
BasePlotObject
Base class of Curves and ShadedAreas.
- Parameters:
sid (str) –
name (str) –
x (sbmlsim.data.Data) –
order (int) –
style (Style) –
yaxis_position (YAxisPosition) –
- class sbmlsim.plot.plotting.Curve(x, y, sid=None, name=None, xerr=None, yerr=None, order=None, type=CurveType.POINTS, style=None, yaxis_position=None, **kwargs)[source]¶
Bases:
AbstractCurve
Curve object.
- Parameters:
x (sbmlsim.data.Data) –
y (sbmlsim.data.Data) –
xerr (sbmlsim.data.Data) –
yerr (sbmlsim.data.Data) –
type (CurveType) –
style (Style) –
yaxis_position (YAxisPosition) –
- class sbmlsim.plot.plotting.ShadedArea(x, yfrom, yto, order=None, style=None, yaxis_position=None, **kwargs)[source]¶
Bases:
AbstractCurve
ShadedArea class.
- Parameters:
x (sbmlsim.data.Data) –
yfrom (sbmlsim.data.Data) –
yto (sbmlsim.data.Data) –
order (Optional[int]) –
style (Style) –
yaxis_position (YAxisPosition) –
- class sbmlsim.plot.plotting.Plot(sid, name=None, xaxis=None, yaxis=None, yaxis_right=None, curves=None, areas=None, legend=True, facecolor=None, title_visible=True, height=None, width=None)[source]¶
Bases:
BasePlotObject
Plot panel.
A plot is the basic element of a plot. This corresponds to a single panel or axes combination in a plot. Multiple plots create a figure.
- Parameters:
- property areas: List[ShadedArea][source]¶
Get areas.
- Return type:
List[ShadedArea]
- set_xaxis(label, unit=None, **kwargs)[source]¶
Set axis with all axes attributes.
All argument of Axis are supported.
- Parameters:
label (Optional[Union[str, Axis]]) –
unit (str) –
- Return type:
None
- set_yaxis(label, unit=None, **kwargs)[source]¶
Set axis with all axes attributes.
All argument of Axis are supported.
- Parameters:
label (Union[str, Axis]) –
unit (str) –
label_visible –
kwargs –
- Returns:
- set_yaxis_right(label, unit=None, **kwargs)[source]¶
Set axis with all axes attributes.
All argument of Axis are supported.
- Parameters:
label (Union[str, Axis]) – label of Axis
unit (str) – unit of the Axis (added to label)
label_visible – boolean flag to make the axis visible or not.
kwargs –
- Returns:
- Return type:
None
- _set_order(abstract_curve)[source]¶
Set order for given AbstractCurve.
- Parameters:
abstract_curve (AbstractCurve) –
- add_curve(curve)[source]¶
Add Curve via the helper function.
All additions must go via this function to ensure data registration.
- Parameters:
curve (Curve) –
- add_area(area)[source]¶
Add ShadedArea via the helper function.
All additions must go via this function to ensure data registration.
- Parameters:
area (ShadedArea) –
- curve(x, y, xerr=None, yerr=None, type=CurveType.POINTS, style=None, yaxis_position=None, **kwargs)[source]¶
Create curve and add to plot.
- Parameters:
x (sbmlsim.data.Data) –
y (sbmlsim.data.Data) –
xerr (sbmlsim.data.Data) –
yerr (sbmlsim.data.Data) –
type (CurveType) –
style (Style) –
yaxis_position (YAxisPosition) –
- add_data(xid, yid, yid_sd=None, yid_se=None, count=None, dataset=None, task=None, label='__yid__', type=CurveType.POINTS, style=None, yaxis_position=None, **kwargs)[source]¶
Add a data curve to the plot.
Styling of curve is based on the provided style and matplotlib kwargs.
- Parameters:
xid (str) – index of x data
yid (str) – index of y data
yid_sd – index of y SD data
yid_se – index of y SE data
count (Union[int, str]) – count for curve (number of subjects)
dataset (str) – dataset id
task (str) – task id
label (Optional[str]) – label for curve (label=None for no label)
type (CurveType) – type of curve (default points)
style (Style) – style for curve
yaxis_position (YAxisPosition) – position of yaxis for this curve
kwargs – matplotlib styling kwargs
- Returns:
- class sbmlsim.plot.plotting.SubPlot(plot, row=None, col=None, row_span=1, col_span=1, sid=None, name=None)[source]¶
Bases:
BasePlotObject
A SubPlot holds a plot in a Figure.
The SubPlot defines the layout used by the plot, i.e., the position and number of panels the plot is spanning.
- Parameters:
plot (Plot) –
row (int) –
col (int) –
row_span (int) –
col_span (int) –
sid (Optional[str]) –
name (Optional[str]) –
- class sbmlsim.plot.plotting.Figure(experiment, sid, name=None, subplots=None, height=None, width=None, num_rows=1, num_cols=1)[source]¶
Bases:
BasePlotObject
A figure consists of multiple subplots.
A reference to the experiment is required, so the plot can resolve the datasets and the simulations.
- Parameters:
experiment (SimulationExperiment) –
sid (str) –
name (str) –
subplots (List[SubPlot]) –
height (float) –
width (float) –
num_rows (int) –
num_cols (int) –
- num_panels()[source]¶
Get number of panel spots for plots.
Plots can span multiple of these panels.
- Return type:
int
- create_plots(xaxis=None, yaxis=None, legend=True)[source]¶
Create plots in the figure.
Settings are applied to all generated plots. E.g. if an xaxis is provided all plots have a copy of this xaxis.
- add_subplot(plot, row, col, row_span=1, col_span=1)[source]¶
Add plot as subplot to figure.
Be careful that individual subplots do not overlap when adding multiple subplots.
- add_plots(plots, copy_plots=False)[source]¶
Add plots to figure.
For every plot a subplot is generated.
- Parameters:
plots (List[Plot]) –
copy_plots (bool) –
- Return type:
None