mass.visualization
Contains function for visualizing simulation results.
This module contains the various functions for visualization of solutions
returned in MassSolution
s after simulation of models.
In general, it is recommended to pass an matplotlib.axes.Axes
instance
into the visualization function in order to guaruntee more control over the
generated plot and ensure that the plot be placed onto a figure as expected.
If an Axes
is not passed into the function, then the
currrent axes instance will be used, accessed via:
matplotlib.pyplot.gca()
All functions will return the axes instance utilzed in generating the plot.
The legend
input format for the plotting function must be one of the
following:
An iterable of legend labels as strings (e.g.
legend=["A", "B", ...]
).A
str
representing the location of the legend, or anint
between 0 and 14 (inclusive) corresponding to the legend location (e.g.legend="best"
orlegend=1
).An iterable of the format
(labels, loc)
to set both the legend labels and location, where thelabels
andloc
in the iterable follows the formats specified above in both 1 and 2, respectively. (e.g.legend=(["A", "B", ...], "best")
)
Valid legend location strings and the integer corresponding to the legend location codes are the following:
Location String (str)
Location Code (int)
‘best’
0
‘upper right’
1
‘upper left’
2
‘lower left’
3
‘lower right’
4
‘right’
5
‘center left’
6
‘center right’
7
‘lower center’
8
‘upper center’
9
‘center’
10
‘upper right outside’
11
‘upper left outside’
12
‘lower left outside’
13
‘lower right outside’
14
‘right outside’
15
‘left outside’
16
‘lower outside’
17
‘upper outside’
18
Some other important things to note about the legend include the following:
Note that the last four “outside” locations are NOT
matplotlib.legend
location values, but rather they utilize the legend kwargbbox_to_anchor
to place the legend outside of the plot.If only legend labels are provided (i.e. format specified above in 1), the default legend location specified in the
matplotlib.rcsetup
will be used.If only the legend location is provided (i.e. format specified above in 2), the corresponding keys in
mass_solution
will be used as default legend labels.If invalid input is provided (e.g. too many legend labels provided, invalid legend location), a warning will be issued and the default values will be used.
See the
matplotlib.legend
documentation for additional control over the plot legend.
The following are optional kwargs
that can be passed to the functions
of the visualiation
module.
- time_vector :
iterable
of values to treat as time points for the solutions. If provided, the original solutions in theMassSolution
input will be converted into interpolating functions and the solutions are recalculated based on the providedtime_vector
. IfNone
then the currenttime
values will be used.Default is
None
.- plot_function :
str
representing the plotting function to use. Accepted values are the following:For all functions:
"plot"
for a linear x-axis and a linear y-axis viaAxes.plot()
"loglog"
for a logarithmic x-axis and a logarithmic y-axis viaAxes.loglog()
In addition, for functions in
time_profiles
andphase_portraits
submodules only:
"semilogx
” for a logarithmic x-axis and a linear y-axis viaAxes.semilogx()
"semilogy"
for a linear x-axis and a logarithmic y-axis viaAxes.semilogy()
Default is
"plot"
.- title :
Either a
str
to set as the title or atuple
of length 2 where the first value is the title string and the second value is adict
of font options. Arguments are passed to the corresponding setter methodAxes.set_title()
.Default is
None
.- xlabel :
Either a
str
to set as the xlabel or atuple
of length 2 where the first value is the xlabel string and the second value is adict
of font options. Arguments are passed to the corresponding setter methodAxes.set_xlabel()
.Default is
None
. Not valid forplot_tiled_phase_portraits()
- ylabel :
Either a
str
to set as the ylabel or atuple
of length 2 where the first value is the ylabel string and the second value is adict
of font options. Arguments are passed to the corresponding setter methodAxes.set_ylabel()
.Default is
None
. Not valid forplot_tiled_phase_portraits()
- xlim :
tuple
of form(xmin, xmax)
containing numerical values specifying the limits of the x-axis. Passed to the corresponding setter methodAxes.set_xlim()
. Forplot_tiled_phase_portraits()
, the limits will be applied to all tiles containing phase portrait plots.Default is
None
.- ylim :
tuple
of form(ymin, ymax)
containing numerical values specifying the limits of the y-axis. Passed to the corresponding setter methodAxes.set_ylim()
. Forplot_tiled_phase_portraits()
, the limits will be applied to all tiles containing phase portrait plots.Default is
None
.- xmargin :
float
value greater than -0.5 to set as the padding for the x-axis data limits prior to autoscaling. Passed to the corresponding setter methodAxes.set_xmargin()
. Forplot_tiled_phase_portraits()
, the margins will be applied to all tiles containing phase portrait plots.Default is
0.15
forplot_tiled_phase_portraits()
, otherwiseNone
.- ymargin :
float
value greater than -0.5 to set as the padding for the y-axis data limits prior to autoscaling. Passed to the corresponding setter methodAxes.set_ymargin()
. Forplot_tiled_phase_portraits()
, the margins will be applied to all tiles containing phase portrait plots.Default is
0.15
forplot_tiled_phase_portraits()
, otherwiseNone
.- color :
Value or
iterable
of values representing validmatplotlib.colors
values to use as line colors. If a single color is provided, that color will be applied to all solutions being plotted. If aniterable
of color values is provided, it must be equal to the number of solutions to be plotted. Forplot_tiled_phase_portraits()
, the colors will be applied to all tiles containing phase portrait plots.Default is
None
. Ignored if the kwargprop_cycler
is also provided.- linestyle :
Value or
iterable
of values representing validmatplotlib
linestyles. If a single linestyle is provided, that linestyle will be applied to all solutions being plotted. If aniterable
is provided, it must be equal to the number of solutions to be plotted. Forplot_tiled_phase_portraits()
, the linestyles will be applied to all tiles containing phase portrait plots.Default is
None
to use default value inmatplotlib.rcsetup
. Ignored if the kwargprop_cycler
is also provided.- linewidth :
float
value representing the linewidth (in points) to set.Default is
None
to use default value inmatplotlib.rcsetup
. Ignored if the kwargprop_cycler
is also provided.- marker :
Value or
iterable
of values representing valudmatplotlib
marker values to use as line markers. If a single marker is provided, that marker will be applied to all solutions being plotted. If aniterable
is provided, it must be equal to the number of solutions to be plotted. Forplot_tiled_phase_portraits()
, the markers will be applied to all tiles containing phase portrait plots.For functions in
comparision
, default is"o"
, otherwise default isNone
to use default value inmatplotlib.rcsetup
. Ignored if the kwargprop_cycler
is also provided.- markersize :
float
value representing the size of the marker (in points) to set. Forplot_tiled_phase_portraits()
, the markersizes will be applied to all tiles containing phase portrait plots. Ignored if the kwargprop_cycler
is also provided.Default is
None
to use default value inmatplotlib.rcsetup
. Ignored if the kwargprop_cycler
is also provided.- grid :
Either a
bool
or atuple
of form(which, axis)
where the values forwhich
andaxis
are one of the following:
which
arguement must be"major"
,"minor"
, or"both"
axis
argument must be"x"
,"y"
, or"both"
If
grid=False
then grid lines will be removed. Ifgrid=True
, then grid lines will be created based on the default values inmatplotlib.rcsetup
unless overridden bygrid_color
,grid_linestyle
, orgrid_linewidth
kwargs. Passed to the setter methodAxes.grid()
. Forplot_tiled_phase_portraits()
, the grid lines will be applied to all tiles containing phase portrait plots.Default is
None
.- grid_color :
Value representing a valid
matplotlib.colors
value to use as the color of the grid lines. Forplot_tiled_phase_portraits()
, the color of the grid lines will be applied to all tiles containing phase portrait plots.Default is
None
to use default value inmatplotlib.rcsetup
. Ignored if the kwarggrid
isNone
.- grid_linestyle :
Value representing a valid
matplotlib
value to use as the linestyles of the grid lines. Forplot_tiled_phase_portraits()
, the linestyle of the grid lines will be applied to all tiles containing phase portrait plots.Default is
None
to use default value inmatplotlib.rcsetup
. Ignored if the kwarggrid
isNone
.- grid_linewidth :
float
value representing the grid linewidth (in points) to set.Default is
None
to use default value inmatplotlib.rcsetup
. Ignored if the kwarggrid
isNone
.- legend_ncol :
int
indicating the number of columns to use in the legend. IfNone
the the following formula is applied:ncols = int(ceil(sqrt(N_total) / 3))where
N_total
is equal to the total number of solution lines.Default is
None
. Not valid forplot_tiled_phase_portraits()
- deviation :
bool
indicating whether to plot the deviation from the initial value for the observable variables.Default is
False
.- deviation_zero_centered :
bool
indicating whether to center deviations around zero for for the observable variables.Default is
False
. Ignored if the kwargdeviation=False
.- deviation_normalization :
str
indicating how to normalize the plotted deviation values. Can be one of the following:
‘initial’ to normalize the solution by dividing by the initial value of the solution variable
‘range’ to normalize the solution through dividing by the range of solution values (maximum value - minimum value)
Default is
initial
. Ignored if the kwargdeviation=False
.- annotate_time_points :
Either the string
"endpoints"
or aniterable
containing the numerical values for the time points of interest to be annotated by plotting points for the solutions at the given time points. Ifannotate_time_points="endpoints"
then only the initial and final time points will be utilized. IfNone
then no time points will be annotated. Forplot_tiled_phase_portraits()
, the time points will be applied to all tiles containing phase portrait plots.Default is
None
.- annotate_time_points_color :
Value or
iterable
of values representing validmatplotlib.colors
values to use as time point colors. If a single color is provided, that color will be applied to all time points being plotted. If aniterable
of color values is provided, it must be equal to the number of time points to be plotted. Forplot_tiled_phase_portraits()
, the colors will be applied to all tiles containing phase portrait plots.Default is
None
.- annotate_time_points_marker :
Value or
iterable
of values representing valudmatplotlib
marker values to use as time point markers. If a single marker is provided, that marker will be applied to all solutions being plotted. If aniterable
is provided, it must be equal to the number of time points to be plotted. Forplot_tiled_phase_portraits()
, the markers will be applied to all tiles containing phase portrait plots.Default is
None
.- annotate_time_points_markersize :
float
value representing the size of the marker (in points) to set. Forplot_tiled_phase_portraits()
, the markersizes will be applied to all tiles containing phase portrait plots.Default is
None
to use default value inmatplotlib.rcsetup
.- annotate_time_points_labels :
bool
indicating whether to annotate the time points with their labels on the plot itself.Default is
False
.- annotate_time_points_legend :
A
str
representing the location of the legend, or anint
between 0 and 14 (inclusive) corresponding to the location to use for the legend of annotated time points. Cannot be the same location value as the plot’slegend
location. IfNone
, no legend is created.Default is
None
.- prop_cycle :
A valid
matplotlib.rcsetup.cycler()
instance to use in the plot. If provided, then thecolor
,linestyle
,linewidth
,marker
, andmarkersize
kwargs are ignored.Default is
None
.- mean_line_alpha :
float
indicating the alpha (opacity) value to use for the line representing the mean solution.Default is
1.0
. Only valid for ensemble visualization functions.- interval_fill_alpha :
float
indicating the alpha (opacity) value to use in shading the interval.Default is
0.5
. Only valid for ensemble visualization functions.- interval_border_alpha :
float
indicating the alpha (opacity) value for border lines of the interval.Default is
0.5
. Only valid for ensemble visualization functions.- CI_distribution :
Either
"t"
to calculate the confidence interval using a t-distribution or"z"
to calculate the confidence interval using a z-distribution.Default is
"t"
. Only valid for ensemble visualization functions.- tile_ticks_on :
bool
indicating whether to leave tick marks on tiles containing phase portraits.Default is
False
. Only valid forplot_tiled_phase_portraits()
.- tile_xlabel_fontdict :
Font properties
to set using adict
. Applied to all tile ylabels.Default is
None
. Only valid forplot_tiled_phase_portraits()
.- tile_ylabel_fontdict :
Font properties
to set using adict
. Applied to all tile ylabels.Default is
None
. Only valid forplot_tiled_phase_portraits()
.- data_tile_fontsize :
Valid
fontsize
value representing the fontsize to be used for the data values on tiles displaying additional data.Default is
large
. Only valid forplot_tiled_phase_portraits()
. Ignored if no additional data is provided (i.e.additional_data=None
).- data_tile_color :
Value representing a valid
matplotlib.colors
value to use as the facecolor of the tiles displaying additional data.Default is
None
to utilize the color"lightgray"
. Only valid forplot_tiled_phase_portraits()
. Ignored if no additional data is provided (i.e.additional_data=None
).- diag_tile_color :
Value representing a valid
matplotlib.colors
value to use as the facecolor of the tiles on the diagonal.Default is
None
to utilize the color"black"
. Only valid forplot_tiled_phase_portraits()
.- empty_tile_color :
Value representing a valid
matplotlib.colors
value to use as the facecolor of the empty tiles.Default is
None
to utilize the color"white"
. Only valid forplot_tiled_phase_portraits()
.- xy_line :
Whether to plot a line with equation
y=x
. Ifxy_line=True
, then the line will be created based on the default values inmatplotlib.rcsetup
unless overridden byxy_linecolor
,xy_linestyle
, orxy_linewidth
kwargs.Ignored if the kwarg
xy_line=False
. Only valid for functions in thecomparison
submodule.- xy_linecolor :
Value representing a valid
matplotlib.colors
value to use as the color of they=x
line.Default is
None
to use default value inmatplotlib.rcsetup
. Ignored if the kwargxy_line=False
. Only valid for functions in thecomparison
submodule.- xy_linestyle :
Value representing a valid
matplotlib
value to use as the style of they=x
line.Default is
None
to use default value inmatplotlib.rcsetup
. Ignored if the kwargxy_line=False
. Only valid for functions in thecomparison
submodule.- xy_linewidth :
float
value representing the linewidth (in points) to set for they=x
line.Default is
None
to use default value inmatplotlib.rcsetup
. Ignored if the kwargxy_line=False
. Only valid for functions in thecomparison
submodule.- xy_legend :
str
indicating where to place a legend for they=x
line.Default is
None
. Ignored if the kwargxy_line=False
. Only valid for functions in thecomparison
submodule.
Submodules
Package Contents
Functions
|
Plot values of two objects for comparision. |
|
Plot a phase portrait for an ensemble of class:~.MassSolution objects. |
|
Plot phase portraits of solutions in a given |
|
Plot phase portraits of solutions in a given |
|
Plot time profiles for an ensemble of class:~.MassSolution objects. |
|
Plot time profiles of solutions in a given |
- mass.visualization.plot_comparison(x, y, compare=None, observable=None, ax=None, legend=None, **kwargs)[source]
Plot values of two objects for comparision.
This function can take two
MassModel
,ConcSolution
,cobra.Solution
, orpandas.Series
objects and plot them against one another in a calibration plot.Accepted
kwargs
are passed onto variousmatplotlib
methods utilized in the function. See thevisualization
module documentation for more detailed information about the possiblekwargs
.Notes
If a
pandas.Series
, the index must correspond to the identifier of the assoicated object. (e.g. a metabolite identifier forcompare="concentrations"
, or a reaction identifier forcompare="Keqs"
)
- Parameters
x (MassModel, ConcSolution, Solution, Series) – The object to access for x-axis values.
y (MassModel, ConcSolution, Solution, Series) – The object to access for y-axis values.
compare (str) –
The values to be compared. Must be one of the following:
"concentrations"
forMassModel
andConcSolution
objects."Keqs"
forMassModel
andConcSolution
objects."fluxes"
forMassModel
andcobra.Solution
objects."kfs"
forMassModel
objects.
Not required if both
x
andy
arepandas.Series
.observable (iterable) – An iterable containing string identifiers of
mass
objects or the objects themselves corresponding to the object or index where the value is located.ax (matplotlib.axes.Axes, None) – An
Axes
instance to plot the data on. IfNone
then the current axes instance is used.There are three possible input formats for the legend:
An iterable of legend labels as strings.
A
str
representing the location of the legend, or anint
between 0 and 14 (inclusive) corresponding to the legend location.An iterable of the format
(labels, loc)
to set both the legend labels and location, wherelabels
andloc
follows the labels specified in 1 and 2.
See the
visualization
documentation for more information about legend and valid legend locations.**kwargs –
plot_function
title
xlabel
ylabel
xlim
ylim
grid
grid_color
grid_linestyle
grid_linewidth
prop_cycle
color
marker
markersize
legend_ncol
xy_line
xy_linecolor
xy_linewidth
xy_linestyle
xy_legend
See
visualization
documentation for more information on optionalkwargs
.
- Returns
ax – The
Axes
instance containing the newly created plot.- Return type
- mass.visualization.plot_ensemble_phase_portrait(mass_solution_list, x, y, ax=None, legend=None, **kwargs)[source]
Plot a phase portrait 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 variousmatplotlib
methods utilized in the function. See thevisualization
module documentation for more detailed information about the possiblekwargs
.Notes
To prevent any changes to the original
MassSolution
, copies ofMassSolution
objects are created and used.
- Parameters
mass_solution_list (iterable) – An iterable of
MassSolution
objects containing the time-dependent solutions to be plotted.x (
mass
object or its string identifier) – The string identifier of amass
object or the object itself that corresponds to the key for the desired solution in theMassSolution
for the x-axis of the phase portrait.y (
mass
object or its string identifier) – The string identifier of amass
object or the object itself that corresponds to the key for the desired solution in theMassSolution
for the y-axis of the phase portrait.ax (matplotlib.axes.Axes, None) – An
Axes
instance to plot the data on. IfNone
then the current axes instance is used.There are three possible input formats for the legend:
An iterable of legend labels as strings.
A
str
representing the location of the legend, or anint
between 0 and 14 (inclusive) corresponding to the legend location.An iterable of the format
(labels, loc)
to set both the legend labels and location, wherelabels
andloc
follows the format 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
deviation
deviation_zero_centered
deviation_normalization
See
visualization
documentation for more information on optionalkwargs
.
- Returns
ax – The
Axes
instance containing the newly created plot.- Return type
- mass.visualization.plot_phase_portrait(mass_solution, x, y, ax=None, legend=None, **kwargs)[source]
Plot phase portraits of solutions in a given
MassSolution
.Accepted
kwargs
are passed onto variousmatplotlib
methods utilized in the function. See thevisualization
module documentation for more detailed information about the possiblekwargs
.Notes
To prevent any changes to the original
MassSolution
, a copy of theMassSolution
is created and used.
- Parameters
mass_solution (MassSolution) – The
MassSolution
containing the time-dependent solutions to be plotted.x (
mass
object or its string identifier) – The string identifier of amass
object or the object itself that corresponds to the key for the desired solution in theMassSolution
for the x-axis of the phase portrait.y (
mass
object or its string identifier) – The string identifier of amass
object or the object itself that corresponds to the key for the desired solution in theMassSolution
for the y-axis of the phase portrait.ax (matplotlib.axes.Axes, None) – An
Axes
instance to plot the data on. IfNone
then the current axes instance is used.There are three possible input formats for the legend:
An iterable of legend labels as strings.
A
str
representing the location of the legend, or anint
between 0 and 14 (inclusive) corresponding to the legend location.An iterable of the format
(labels, loc)
to set both the legend labels and location, wherelabels
andloc
follows the format 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
deviation
deviation_zero_centered
deviation_normalization
See
visualization
documentation for more information on optionalkwargs
.
- Returns
ax – The
Axes
instance containing the newly created plot.- Return type
- mass.visualization.plot_tiled_phase_portraits(mass_solution, observable=None, ax=None, plot_tile_placement='all', additional_data=None, **kwargs)[source]
Plot phase portraits of solutions in a given
MassSolution
.Accepted
kwargs
are passed onto various matplotlib methods in utilized in the function. See thevisualization
module documentation for more detailed information about the possiblekwargs
.Notes
To prevent any changes to the original
MassSolution
, a copy of theMassSolution
will be created and used.i
andj
represent the number of rows and columns, respectively.
- Parameters
mass_solution (MassSolution) – The
MassSolution
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 theMassSolution
.ax (matplotlib.axes.Axes, None) – An
Axes
instance to plot the data on. IfNone
then the current axes instance is used.plot_tile_placement (str) –
A string representing the location to place the tiles containing phase portrait plots. Must be one of the following:
"lower"
to place plot tiles on the lower left triangular section(i < j)
on the figure tiles."upper"
to place plot tiles on the upper right triangular section(i > j)
on the figure tiles.all
to place plot tiles on the lower left triangular section(i < j)
AND on the upper right triangular section(i > j)
on the figure tiles.
additional_data (array_like, None) – A matrix of shape
(N, N)
whereN_obs
is the number of observables provided, or the number of keys in theMassSolution
ifobservable=None
. The value at(i, j)
of the matrix must correspond to the empty tile that the data should be displayed on. All other values are ignored. IfNone
then no data will be displayed and tiles will be left empty.**kwargs –
time_vector
plot_function
title
xlim
ylim
grid
grid_color
grid_linestyle
grid_linewidth
prop_cycle
color
linestyle
linewidth
marker
markersize
annotate_time_points
annotate_time_points_color
annotate_time_points_marker
annotate_time_points_markersize
annotate_time_points_legend
annotate_time_points_zorder
tile_ticks_on
tile_xlabel_fontdict
tile_ylabel_fontdict
data_tile_fontsize
data_tile_color
diag_tile_color
empty_tile_color
See
visualization
documentation for more information on optionalkwargs
.
- Returns
ax – The
Axes
instance containing the newly created plot.- Return type
- mass.visualization.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 variousmatplotlib
methods utilized in the function. See thevisualization
module documentation for more detailed information about the possiblekwargs
.Notes
To prevent any changes to the original
MassSolution
, copies ofMassSolution
objects are created and used.
- 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 theMassSolution
.ax (matplotlib.axes.Axes, None) – An
Axes
instance to plot the data on. IfNone
then the current axes instance is used.There are three possible input formats for the legend:
An iterable of legend labels as strings.
A
str
representing the location of the legend, or anint
between 0 and 14 (inclusive) corresponding to the legend location.An iterable of the format
(labels, loc)
to set both the legend labels and location, wherelabels
andloc
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 optionalkwargs
.
- Returns
ax – The
Axes
instance containing the newly created plot.- Return type
- mass.visualization.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 variousmatplotlib
methods utilized in the function. See thevisualization
module documentation for more detailed information about the possiblekwargs
.Notes
To prevent any changes to the original
MassSolution
, a copy of theMassSolution
is created and used.
- 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 theMassSolution
. IfNone
then all solutions are plotted.ax (matplotlib.axes.Axes, None) – An
Axes
instance to plot the data on. IfNone
then the current axes instance is used.There are three possible input formats for the legend:
An iterable of legend labels as strings.
A
str
representing the location of the legend, or anint
between 0 and 14 (inclusive) corresponding to the legend location.An iterable of the format
(labels, loc)
to set both the legend labels and location, wherelabels
andloc
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 optionalkwargs
.
- Returns
ax – The
Axes
instance containing the newly created plot.- Return type