Skip to content

plot.axes

Labels of the axes of matplotlib which plot quantities.

A quantity of a result, ScanResult.q, plots with matplotlib in its unit: the first quantity of an axis sets its unit, every other one is converted into it, see sbmlsim.units.setup_matplotlib. label_axes names the axes and adds their units:

fig, ax = plt.subplots()
ax.plot(res.q["time"].to("hr"), res.q["cp"])
label_axes(ax, "time", "HCTZ plasma")  # "time [h]", "HCTZ plasma [ng/ml]"

axis_label

axis_label(name, axis)

Get the label of an axis: its name and the unit of its quantities.

Parameters:

Name Type Description Default
name str

the name of what the axis shows.

required
axis Axis

the axis of matplotlib.

required

Returns:

Type Description
str

name [unit] in the short form of the unit, the name for an axis

str

without a unit or with a dimensionless one.

label_axes

label_axes(ax, x=None, y=None)

Label the axes of a plot of quantities with their names and units.

Call it after the quantities are plotted, which set the units of the axes, e.g. label_axes(ax, "time", "HCTZ plasma") gives time [h] and HCTZ plasma [ng/ml].

Parameters:

Name Type Description Default
ax Axes

the axes.

required
x str | None

the name of the x axis, None keeps its label.

None
y str | None

the name of the y axis, None keeps its label.

None