cellpy.utils.plotutils#

Utilities for helping to plot cellpy-data.

Module Contents#

Functions#

create_col_info(c)

Create column information for summary plots.

create_colormarkerlist(groups, sub_groups[, ...])

Fetch lists with color names and marker types of correct length.

create_colormarkerlist_for_journal(journal[, ...])

Fetch lists with color names and marker types of correct length for a journal.

create_label_dict(c)

Create label dictionary for summary plots.

cycle_info_plot(cell[, cycle, get_axes, interactive, ...])

Show raw data together with step and cycle information.

partition_summary_cv_steps(c, x, column_set[, split, ...])

Partition the summary data into CV and non-CV steps.

raw_plot(cell[, y, y_label, x, x_label, title, ...])

Plot raw data.

summary_plot(c[, x, y, height, markers, title, ...])

Create a summary plot. Currently only supports plotly.

Attributes#

COLOR_DICT

SYMBOL_DICT

plotly_available

seaborn_available

create_col_info(c)[source]#

Create column information for summary plots.

Parameters:

c – cellpy object

Returns:

x_columns (tuple), y_cols (dict)

create_colormarkerlist(groups, sub_groups, symbol_label='all', color_style_label='seaborn-colorblind')[source]#

Fetch lists with color names and marker types of correct length.

Parameters:
  • groups – list of group numbers (used to generate the list of colors)

  • sub_groups – list of sub-group numbers (used to generate the list of markers).

  • symbol_label – sub-set of markers to use

  • color_style_label – cmap to use for colors

Returns:

colors (list), markers (list)

create_colormarkerlist_for_journal(journal, symbol_label='all', color_style_label='seaborn-colorblind')[source]#

Fetch lists with color names and marker types of correct length for a journal.

Parameters:
  • journal – cellpy journal

  • symbol_label – sub-set of markers to use

  • color_style_label – cmap to use for colors

Returns:

colors (list), markers (list)

create_label_dict(c)[source]#

Create label dictionary for summary plots.

Parameters:

c – cellpy object

Returns:

x_axis_labels (dict), y_axis_label (dict)

cycle_info_plot(cell, cycle=None, get_axes=False, interactive=True, t_unit='hours', v_unit='V', i_unit='mA', **kwargs)[source]#

Show raw data together with step and cycle information.

Parameters:
  • cell – cellpy object

  • cycle (int or list or tuple) – cycle(s) to select (must be int for matplotlib)

  • get_axes (bool) – return axes (for matplotlib) or figure (for plotly)

  • interactive (bool) – use interactive plotting (if available)

  • t_unit (str) – unit for x-axis (default: “hours”)

  • v_unit (str) – unit for y-axis (default: “V”)

  • i_unit (str) – unit for current (default: “mA”)

  • **kwargs – parameters specific to plotting backend.

Returns:

matplotlib.axes or None

partition_summary_cv_steps(c, x: str, column_set: list, split: bool = False, var_name: str = 'variable', value_name: str = 'value')[source]#

Partition the summary data into CV and non-CV steps.

Parameters:
  • c – cellpy object

  • x – x-axis column name

  • column_set – names of columns to include

  • split – add additional column that can be used to split the data when plotting.

  • var_name – name of the variable column after melting

  • value_name – name of the value column after melting

Returns:

pandas.DataFrame (melted with columns x, var_name, value_name, and optionally “row” if split is True)

raw_plot(cell, y=None, y_label=None, x=None, x_label=None, title=None, interactive=True, plot_type='voltage-current', double_y=True, return_matplotlib_figure=False, **kwargs)[source]#

Plot raw data.

Parameters:
  • cell – cellpy object

  • y (str or list) – y-axis column

  • y_label (str or list) – label for y-axis

  • x (str) – x-axis column

  • x_label (str) – label for x-axis

  • title (str) – title of the plot

  • interactive (bool) – use interactive plotting

  • plot_type (str) – type of plot (defaults to “voltage-current”) (overrides given y if y is not None), currently only “voltage-current” is supported.

  • double_y (bool) – use double y-axis (only for matplotlib and when plot_type is used)

  • return_matplotlib_figure (bool) – return a matplotlib figure (only for matplotlib)

  • **kwargs – additional parameters for the plotting backend

Returns:

matplotlib figure or plotly figure

summary_plot(c, x: str = None, y: str = 'capacities_gravimetric', height: int = 600, markers: bool = True, title=None, x_range: list = None, y_range: list = None, split: bool = False, interactive: bool = True, share_y: bool = False, rangeslider: bool = False, **kwargs)[source]#

Create a summary plot. Currently only supports plotly.

Parameters:
  • c – cellpy object

  • x – x-axis column (default: ‘cycle_index’)

  • y

    y-axis column or column set. Currently, the following predefined sets exists:

    • ”voltages”, “capacities_gravimetric”, “capacities_areal”, “capacities”, “capacities_gravimetric_split_constant_voltage”, “capacities_areal_split_constant_voltage”

  • height – height of the plot

  • markers – use markers

  • title – title of the plot

  • x_range – limits for x-axis

  • y_range – limits for y-axis

  • split – split the plot

  • interactive – use interactive plotting

  • rangeslider – add a range slider to the x-axis (only for plotly)

  • share_y (bool) – share y-axis

  • **kwargs – additional parameters for the plotting backend

Returns:

plotly figure or None

COLOR_DICT[source]#
SYMBOL_DICT[source]#
plotly_available[source]#
seaborn_available[source]#