pyamr.utils package

Subpackages

Submodules

pyamr.utils.plot module

Classes:

MidpointNormalize([vmin, vmax, midpoint, clip])

Normalise the colorbar so that diverging bars work their way either side from a prescribed midpoint value)

Functions:

create_mapper(dataframe, column_key, ...)

This method constructs a mapper

get_category_colors(index, category[, cmap])

Creates the colors for the different elements in a given categorical feature vector.

hlinebgplot(ax, right, yv[, bg])

This function adds a vertical line and background

plot_sns_clustermap()

plot_sns_heatmap()

plot_sns_relmap()

plot_spectrum()

plot_timeseries()

scalar_colormap(values, cmap, vmin, vmax)

This method creates a colormap based on values.

vlinebgplot(ax, top, xv[, bg])

This function adds a vertical line and background

class pyamr.utils.plot.MidpointNormalize(vmin=None, vmax=None, midpoint=None, clip=False)[source]

Bases: Normalize

Normalise the colorbar so that diverging bars work their way either side from a prescribed midpoint value)

Example

> MidpointNormalize(midpoint=0., vmin=-100, vmax=100)

pyamr.utils.plot.create_mapper(dataframe, column_key, column_value)[source]

This method constructs a mapper

Parameters:
  • dataframe (dataframe-like) – The dataframe from which the columns are extracted

  • column_key (string-like) – The name of the column with the values for the keys of the mapper

  • column_value (string-like) – The name of the column with the values for the values of the mapper

Return type:

dictionary

pyamr.utils.plot.get_category_colors(index, category, cmap='hls')[source]

Creates the colors for the different elements in a given categorical feature vector.

Parameters:
  • values (array-like) – The vector with the categorical values

  • cmap (string-like) – The colormap to use

  • default (string-like) – The color to be used for the first value. Note that this value needs to appear first on the the sorted list, as such it is recommended to set is as _default.

Returns:

List of colors.

Return type:

pd.Series

pyamr.utils.plot.hlinebgplot(ax, right, yv, bg=None)[source]

This function adds a vertical line and background

pyamr.utils.plot.plot_sns_clustermap()[source]
pyamr.utils.plot.plot_sns_heatmap()[source]
pyamr.utils.plot.plot_sns_relmap()[source]
pyamr.utils.plot.plot_spectrum()[source]
pyamr.utils.plot.plot_timeseries()[source]
pyamr.utils.plot.scalar_colormap(values, cmap, vmin, vmax)[source]

This method creates a colormap based on values.

Parameters:
  • values (array-like)

  • The values to create the corresponding colors

  • cmap (str)

  • The colormap

  • vmin, vmax (float)

  • The minimum and maximum possible values

Return type:

scalar colormap

pyamr.utils.plot.vlinebgplot(ax, top, xv, bg=None)[source]

This function adds a vertical line and background

Parameters:
  • ax (matplotlib axes)

  • top (float) – The max y value

  • xv (float) – The x value

  • bg (boolean) – Whether to include a background

Module contents