mass.visualization.time_profiles

Contains function for visualizing time profiles of simulation results.

See the mass.visualization documentation for general information on mass.visualization functions.

This module contains the following functions for visualization of time-dependent solutions returned in MassSolutions after simulation of models.

Module Contents

Functions

plot_time_profile(mass_solution[, observable, ax, legend])

Plot time profiles of solutions in a given MassSolution.

plot_ensemble_time_profile(mass_solution_list, observable)

Plot time profiles for an ensemble of class:~.MassSolution objects.

get_time_profile_default_kwargs(function_name)

Get default kwargs for plotting functions in time_profiles.

mass.visualization.time_profiles.plot_time_profile(mass_solution, observable=None, ax=None, legend=None, **kwargs)[source]

Plot time profiles of solutions in a given MassSolution.

Accepted kwargs are passed onto various matplotlib methods utilized in the function. See the visualization module documentation for more detailed information about the possible kwargs.

Notes

Parameters
  • mass_solution (MassSolution) – The MassSolution containing the time-dependent solutions to be plotted.

  • observable (iterable, None) – An iterable containing string identifiers of the mass objects or the objects themselves that correspond to the keys for the desired solutions in the MassSolution. If None then all solutions are plotted.

  • ax (matplotlib.axes.Axes, None) – An Axes instance to plot the data on. If None then the current axes instance is used.

  • legend (iterable, str, int) –

    There are three possible input formats for the legend:

    1. An iterable of legend labels as strings.

    2. A str representing the location of the legend, or an int between 0 and 14 (inclusive) corresponding to the legend location.

    3. An iterable of the format (labels, loc) to set both the legend labels and location, where labels and loc follows the labels specified in 1 and 2.

    See the visualization documentation for more information about legend and valid legend locations.

  • **kwargs

    • time_vector

    • plot_function

    • title

    • xlabel

    • ylabel

    • xlim

    • ylim

    • grid

    • grid_color

    • grid_linestyle

    • grid_linewidth

    • prop_cycle

    • color

    • linestyle

    • linewidth

    • marker

    • markersize

    • legend_ncol

    • annotate_time_points

    • annotate_time_points_color

    • annotate_time_points_marker

    • annotate_time_points_markersize

    • annotate_time_points_labels

    • annotate_time_points_legend

    • annotate_time_points_zorder

    • deviation

    • deviation_zero_centered

    • deviation_normalization

    See visualization documentation for more information on optional kwargs.

Returns

ax – The Axes instance containing the newly created plot.

Return type

matplotlib.axes.Axes

mass.visualization.time_profiles.plot_ensemble_time_profile(mass_solution_list, observable, ax=None, legend=None, interval_type=None, **kwargs)[source]

Plot time profiles for an ensemble of class:~.MassSolution objects.

The plotted lines represent the mean for the values of a particular solution specified in observable.

Accepted kwargs are passed onto various matplotlib methods utilized in the function. See the visualization module documentation for more detailed information about the possible kwargs.

Notes

Parameters
  • mass_solution_list (iterable) – An iterable of MassSolution objects containing the time-dependent solutions to be plotted.

  • observable (iterable) – An iterable containing string identifiers of the mass objects or the objects themselves that correspond to the keys for the desired solutions in the MassSolution.

  • ax (matplotlib.axes.Axes, None) – An Axes instance to plot the data on. If None then the current axes instance is used.

  • legend (iterable, str, int) –

    There are three possible input formats for the legend:

    1. An iterable of legend labels as strings.

    2. A str representing the location of the legend, or an int between 0 and 14 (inclusive) corresponding to the legend location.

    3. An iterable of the format (labels, loc) to set both the legend labels and location, where labels and loc follows the labels specified in 1 and 2.

    See the visualization documentation for more information about legend and valid legend locations.

  • interval_type (str, None) –

    The type of interval to display with the plotted mean of the solution. Can be one of the following:

    • "range": Interval shading occurs from the minimum to the maximum value for each time point.

    • "CI=": Interval shading occurs for a confidence interval. (e.g. confidence interval of 95% is specified as "CI=95.0".)

    • None to prevent interval shading from occurring.

    Default is None

  • **kwargs

    • time_vector

    • plot_function

    • title

    • xlabel

    • ylabel

    • xlim

    • ylim

    • grid

    • grid_color

    • grid_linestyle

    • grid_linewidth

    • prop_cycle

    • color

    • linestyle

    • linewidth

    • marker

    • markersize

    • legend_ncol

    • annotate_time_points

    • annotate_time_points_color

    • annotate_time_points_marker

    • annotate_time_points_markersize

    • annotate_time_points_labels

    • annotate_time_points_legend

    • deviation

    • deviation_zero_centered

    • deviation_normalization

    • mean_line_alpha

    • interval_fill_alpha

    • interval_border_alpha

    • CI_distribution

    See visualization documentation for more information on optional kwargs.

Returns

ax – The Axes instance containing the newly created plot.

Return type

matplotlib.axes.Axes

mass.visualization.time_profiles.get_time_profile_default_kwargs(function_name)[source]

Get default kwargs for plotting functions in time_profiles.

Parameters

function_name (str) –

The name of the plotting function to get the kwargs for. Valid values include the following:

  • "plot_time_profile"

Returns

Default kwarg values for the given function_name.

Return type

dict