mass.visualization.comparison

Contains function for visually comparing values in various objects.

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

This module contains the following functions for visually comparing a set of values in one object against a similar set of valeus in another object.

Module Contents

Functions

plot_comparison(x, y[, compare, observable, ax, legend])

Plot values of two objects for comparision.

get_comparison_default_kwargs(function_name)

Get default kwargs for plotting functions in comparison.

mass.visualization.comparison.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, or pandas.Series objects and plot them against one another in a calibration plot.

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

  • If a pandas.Series, the index must correspond to the identifier of the assoicated object. (e.g. a metabolite identifier for compare="concentrations", or a reaction identifier for compare="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:

    Not required if both x and y are pandas.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. 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

    • 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 optional kwargs.

Returns

ax – The Axes instance containing the newly created plot.

Return type

matplotlib.axes.Axes

mass.visualization.comparison.get_comparison_default_kwargs(function_name)[source]

Get default kwargs for plotting functions in comparison.

Parameters

function_name (str) –

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

  • "plot_comparison"

Returns

Default kwarg values for the given function_name.

Return type

dict