sbmlsim.plot.plotting

Base classes for storing plotting information.

The general workflow of generating plotting information is the following.

  1. Within simulation experiments abstract plotting information is stored.

    i.e., how from the data plots can be generated.

Module Contents

Classes

BasePlotObject

Base class for plotting objects.

LineType

Generic enumeration.

MarkerType

Generic enumeration.

CurveType

Generic enumeration.

ColorType

Line

Marker

Fill

Style

Base class for plotting objects.

Axis

Base class for plotting objects.

AbstractCurve

Base class for plotting objects.

Curve

Base class for plotting objects.

Plot

Plot panel.

SubPlot

A SubPlot is a locate plot in a figure.

Figure

A figure consists of multiple subplots.

Attributes

logger

DEFAULT_COLORS

sbmlsim.plot.plotting.logger[source]
sbmlsim.plot.plotting.DEFAULT_COLORS = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f',...[source]
class sbmlsim.plot.plotting.BasePlotObject(sid, name)[source]

Bases: object

Base class for plotting objects.

Parameters
  • sid (str) –

  • name (str) –

class sbmlsim.plot.plotting.LineType[source]

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

NONE = 1[source]
SOLID = 2[source]
DASH = 3[source]
DOT = 4[source]
DASHDOT = 5[source]
DASHDOTDOT = 6[source]
class sbmlsim.plot.plotting.MarkerType[source]

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

NONE = 1[source]
SQUARE = 2[source]
CIRCLE = 3[source]
DIAMOND = 4[source]
XCROSS = 5[source]
PLUS = 6[source]
STAR = 7[source]
TRIANGLEUP = 8[source]
TRIANGLEDOWN = 9[source]
TRIANGLELEFT = 10[source]
TRIANGLERIGHT = 11[source]
HDASH = 12[source]
VDASH = 13[source]
class sbmlsim.plot.plotting.CurveType[source]

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

POINTS = 1[source]
BAR = 2[source]
BARSTACKED = 3[source]
HORIZONTALBAR = 4[source]
HORIZONTALBARSTACKED = 5[source]
POLARPOINT = 6[source]
POLARBAR = 7[source]
POLARBARSTACKED = 8[source]
class sbmlsim.plot.plotting.ColorType(color)[source]

Bases: object

Parameters

color (str) –

to_dict(self)[source]
__repr__(self)[source]

Return repr(self).

class sbmlsim.plot.plotting.Line[source]

Bases: object

type :LineType[source]
color :ColorType[source]
thickness :float[source]
to_dict(self)[source]
class sbmlsim.plot.plotting.Marker[source]

Bases: object

size :float[source]
type :MarkerType[source]
fill :ColorType[source]
line_color :ColorType[source]
line_thickness :float = 1.0[source]
to_dict(self)[source]
class sbmlsim.plot.plotting.Fill[source]

Bases: object

color :ColorType[source]
second_color :ColorType[source]
class sbmlsim.plot.plotting.Style(sid=None, name=None, base_style=None, line=None, marker=None, fill=None)[source]

Bases: BasePlotObject

Base class for plotting objects.

Parameters
  • sid (str) –

  • name (str) –

  • base_style (Style) –

  • line (Line) –

  • marker (Marker) –

  • fill (Fill) –

MPL2SEDML_LINESTYLE_MAPPING[source]
SEDML2MPL_LINESTYLE_MAPPING[source]
MPL2SEDML_MARKER_MAPPING[source]
SEDML2MPL_MARKER_MAPPING[source]
to_mpl_kwargs(self)[source]

Convert to matplotlib plotting arguments

Return type

Dict

static parse_color(color, alpha=1.0)[source]

Parse given color and add alpha information.

Parameters
  • color (str) –

  • alpha (float) –

Returns

ColorType or None

Return type

Optional[ColorType]

static from_mpl_kwargs(**kwargs)[source]

Creates style from matplotlib arguments.

Parameters
  • alpha – alpha setting

  • color – color setting

  • kwargs

Returns

Return type

Style

class sbmlsim.plot.plotting.Axis(label=None, unit=None, name=None, scale=AxisScale.LINEAR, min=None, max=None, grid=False, label_visible=True, ticks_visible=True)[source]

Bases: BasePlotObject

Base class for plotting objects.

Parameters
  • label (str) –

  • unit (str) –

  • name (str) –

  • scale (AxisScale) –

  • min (float) –

  • max (float) –

  • grid (bool) –

class AxisScale[source]

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

LINEAR = 1[source]
LOG10 = 2[source]
__copy__(self)[source]
__str__(self)[source]

Return str(self).

property scale(self)[source]
to_dict(self)[source]

Convert to dictionary.

class sbmlsim.plot.plotting.AbstractCurve(sid, name, x, order, style, yaxis)[source]

Bases: BasePlotObject

Base class for plotting objects.

Parameters
class sbmlsim.plot.plotting.Curve(x, y, xerr=None, yerr=None, single_lines=False, dim_reductions=None, order=None, style=None, yaxis=None, **kwargs)[source]

Bases: AbstractCurve

Base class for plotting objects.

Parameters
__str__(self)[source]

Return str(self).

static _add_default_style_kwargs(d, dtype)[source]

Default plotting styles

Parameters
  • d (Dict) –

  • dtype (str) –

Return type

Dict

to_dict(self)[source]

Convert to dictionary.

class sbmlsim.plot.plotting.Plot(sid, name=None, legend=False, xaxis=None, yaxis=None, curves=None, facecolor=Style.parse_color('white'), title_visible=True)[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
  • sid (str) –

  • name (str) –

  • legend (bool) –

  • xaxis (Axis) –

  • yaxis (Axis) –

  • curves (List[Curve]) –

__copy__(self)[source]
to_dict(self)[source]

Convert to dictionary.

property figure(self)[source]
Return type

Figure

property experiment(self)[source]
property title(self)[source]
set_title(self, title)[source]
Parameters

title (str) –

property xaxis(self)[source]
Return type

Axis

set_xaxis(self, 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

property yaxis(self)[source]
Return type

Axis

set_yaxis(self, 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

add_curve(self, curve)[source]

Curves are added via the helper function.

Parameters

curve (Curve) –

property curves(self)[source]
Return type

List[Curve]

curve(self, x, y, xerr=None, yerr=None, single_lines=False, dim_reductions=None, **kwargs)[source]

Adds curve to the plot.

Data can be high-dimensional data from a scan. 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.

Parameters
add_data(self, xid, yid, yid_sd=None, yid_se=None, count=None, dataset=None, task=None, label='__yid__', single_lines=False, dim_reduction=None, **kwargs)[source]

Wrapper around plotting.

Parameters
  • xid (str) –

  • yid (str) –

  • count (Union[int, str]) –

  • dataset (str) –

  • task (str) –

  • label (str) –

class sbmlsim.plot.plotting.SubPlot(plot, row=None, col=None, row_span=1, col_span=1)[source]

Bases: BasePlotObject

A SubPlot is a locate plot in a figure.

Parameters
  • plot (Plot) –

  • row (int) –

  • col (int) –

  • row_span (int) –

  • col_span (int) –

__str__(self)[source]

Return str(self).

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
  • sid (str) –

  • name (str) –

  • subplots (List[SubPlot]) –

  • height (float) –

  • width (float) –

  • num_rows (int) –

  • num_cols (int) –

fig_dpi = 72[source]
fig_facecolor = white[source]
fig_subplots_wspace = 0.3[source]
fig_subplots_hspace = 0.3[source]
panel_width = 7[source]
panel_height = 5[source]
fig_titlesize = 25[source]
fig_titleweight = bold[source]
axes_titlesize = 20[source]
axes_titleweight = bold[source]
axes_labelsize = 18[source]
axes_labelweight = bold[source]
xtick_labelsize = 15[source]
ytick_labelsize = 15[source]
legend_fontsize = 13[source]
legend_loc = best[source]
_area_interpolation_points = 300[source]
num_subplots(self)[source]

Number of existing subplots.

num_panels(self)[source]

Number of available spots for plots.

set_title(self, title)[source]
create_plots(self, xaxis=None, yaxis=None, legend=True)[source]

Template function for creating plots

Parameters
  • xaxis (Axis) –

  • yaxis (Axis) –

  • legend (bool) –

Return type

List[Plot]

property plots(self)[source]
get_plots(self)[source]

Returns list of plots.

Return type

List[Plot]

add_plots(self, 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

static from_plots(sid, plots)[source]

Create figure object from list of plots.

Parameters

plots (List[Plot]) –

Return type

Figure

to_dict(self)[source]

Convert to dictionary.