sbmlsim.plot
¶
Plotting in sbmlsim.
Submodules¶
Package Contents¶
Classes¶
A figure consists of multiple subplots. |
|
Plot panel. |
|
Axis object. |
|
A SubPlot holds a plot in a Figure. |
|
Curve object. |
|
ColorType class. |
|
MarkerType options. |
- class sbmlsim.plot.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) –
- property height: float¶
Get height.
- Return type:
float
- property width: float¶
Get width.
- Return type:
float
- fig_dpi: int = 72¶
- fig_facecolor: str = 'white'¶
- fig_subplots_wspace: float = 0.3¶
- fig_subplots_hspace: float = 0.3¶
- panel_width: float = 7.0¶
- panel_height: float = 5.0¶
- fig_titlesize: int = 25¶
- fig_titleweight: str = 'bold'¶
- axes_titlesize: int = 20¶
- axes_titleweight: str = 'bold'¶
- axes_labelsize: int = 18¶
- axes_labelweight: str = 'bold'¶
- xtick_labelsize: int = 15¶
- ytick_labelsize: int = 15¶
- legend_fontsize: int = 13¶
- legend_position: str = 'inside'¶
- legend_loc: str = 'best'¶
- _area_interpolation_points: int = 300¶
- __repr__()¶
Get representation string.
- Return type:
str
- num_subplots()¶
Get number ofsubplots.
- Return type:
int
- num_panels()¶
Get number of panel spots for plots.
Plots can span multiple of these panels.
- Return type:
int
- set_title(title)¶
Set title.
- create_plots(xaxis=None, yaxis=None, legend=True)¶
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)¶
Add plot as subplot to figure.
Be careful that individual subplots do not overlap when adding multiple subplots.
- add_plots(plots, copy_plots=False)¶
Add plots to figure.
For every plot a subplot is generated.
- Parameters:
plots (List[Plot]) –
copy_plots (bool) –
- Return type:
None
- static from_plots(sid, plots)¶
Create figure object from list of plots.
- to_dict()¶
Convert to dictionary.
- class sbmlsim.plot.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 experiment¶
Get simulation experiment for this plot.
- property title: str¶
Get title.
- Return type:
str
- property areas: List[ShadedArea]¶
Get areas.
- Return type:
List[ShadedArea]
- __repr__()¶
Get representation string.
- Return type:
str
- __str__()¶
Get string.
- Return type:
str
- to_dict()¶
Convert to dictionary.
- set_title(title)¶
Set title.
- Parameters:
title (str) –
- Return type:
None
- set_xaxis(label, unit=None, **kwargs)¶
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)¶
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)¶
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
- static _create_axis(label, unit=None, **kwargs)¶
- _set_order(abstract_curve)¶
Set order for given AbstractCurve.
- Parameters:
abstract_curve (AbstractCurve) –
- add_curve(curve)¶
Add Curve via the helper function.
All additions must go via this function to ensure data registration.
- Parameters:
curve (Curve) –
- add_area(area)¶
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)¶
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)¶
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.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:
- __repr__()¶
Get string.
- Return type:
str
- __str__()¶
Get string.
- Return type:
str
- to_dict()¶
Convert to dictionary.
- class sbmlsim.plot.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]) –
- __str__()¶
Get string.
- class sbmlsim.plot.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) –
- __repr__()¶
Get representation string.
- Return type:
str
- __str__()¶
Get string.
- Return type:
str
- static _add_default_style_kwargs(d, dtype)¶
Add the default plotting style arguments.
- Parameters:
d (Dict) –
dtype (str) –
- Return type:
Dict
- to_dict()¶
Convert Curve to dictionary.