Visualization#
stochastix.utils.visualization.plot_abundance_dynamic #
plot_abundance_dynamic(
ssa_results: SimulationResults,
species: str | list[str] | tuple[str, ...] = '*',
time_unit: Literal['s', 'm', 'h', 'd'] = 's',
figsize: tuple[float, float] = (9, 6),
line_alpha: float = 0.5,
log_x_scale: bool = False,
log_y_scale: bool = False,
grid_params: dict[str, Any] | None = None,
ax: Axes | None = None,
species_labels: list[str] | None = None,
legend: bool = True,
base_time_unit: Literal['s', 'm', 'h', 'd'] = 's',
) -> tuple[plt.Figure | None, plt.Axes]
Plot the time evolution of molecular abundances.
Parameters:
-
ssa_results(SimulationResults) –A SimulationResults object containing time points and abundances.
-
species(str | list[str] | tuple[str, ...], default:'*') –The species to plot. Can be "*" for all species, a single species name, or a list/tuple of species names.
-
time_unit(Literal['s', 'm', 'h', 'd'], default:'s') –The time unit for the x-axis ('s', 'm', 'h', 'd').
-
figsize(tuple[float, float], default:(9, 6)) –The figure size (width, height).
-
line_alpha(float, default:0.5) –The transparency of the plot lines.
-
log_x_scale(bool, default:False) –Whether to use a logarithmic scale for the x-axis.
-
log_y_scale(bool, default:False) –Whether to use a logarithmic scale for the y-axis.
-
grid_params(dict[str, Any] | None, default:None) –A dictionary of parameters for grid customization.
-
ax(Axes | None, default:None) –A matplotlib.axes.Axes object to plot on. If
None, a new figure and axes are created. -
species_labels(list[str] | None, default:None) –A list of custom labels for the species. If None, the species names from
ssa_resultsare used. -
legend(bool, default:True) –Whether to display the legend.
-
base_time_unit(Literal['s', 'm', 'h', 'd'], default:'s') –Time unit of ssa_results.t (used for conversion to time_unit).
Returns:
-
Figure | None–A tuple
(fig, ax), wherefigis thematplotlib.figure.Figure -
Axes–object (or None if
axwas provided) andaxis the -
tuple[Figure | None, Axes]–matplotlib.axes.Axesobject.
Raises:
-
ValueError–If
ssa_resultsis missing required attributes,time_unitis invalid, or a species name is not found.