pya.helper.visualization

Module Contents

Functions

basicplot(data, ticks, channels[, offset, scale, cn, ...])

Basic version of the plot for pya, this can be directly used

gridplot(pya_objects[, colwrap, cbar_ratio, figsize])

Create a grid plot of pya objects which have plot() methods,

pya.helper.visualization.basicplot(data, ticks, channels, offset=0, scale=1, cn=None, ax=None, typ='plot', cmap='inferno', xlim=None, ylim=None, xlabel='', ylabel='', show_bar=False, **kwargs)

Basic version of the plot for pya, this can be directly used by Asig. Aspec/Astft/Amfcc will have different extra setting and type.

Parameters:
  • data (numpy.ndarray) – data array

  • channels (int) – number of channels

  • axis (matplotlib.axes, optional) – Plot image on the matplotlib axis if it was given. Default is None, which use plt.gca()

  • typ (str, optional) – Plot type.

pya.helper.visualization.gridplot(pya_objects, colwrap=1, cbar_ratio=0.04, figsize=None)

Create a grid plot of pya objects which have plot() methods, i.e. Asig, Aspec, Astft, Amfcc. It takes a list of pya_objects and plot each object into a grid. You can mix different types of plots together.

Examples

# plot all 4 different pya objects in 1 column, amfcc and astft use pcolormesh so colorbar will # be displayed as well gridplot([asig, amfcc, aspec, astft], colwrap=2,

cbar_ratio=0.08, figsize=[10, 10]);

Parameters:
  • pya_objects (iterable object) – A list of pya objects with the plot() method.

  • colwrap (int, optional) – Wrap column at position. Can be considered as the column size. Default is 1, meaning 1 column.

  • cbar_ratio (float, optional) – For each column create another column reserved for the colorbar. This is the ratio of the width relative to the plot. 0.04 means 4% of the width of the data plot.

  • figsize (tuple, optional) – width, height of the entire image in inches. Default size is (6.4, 4.8)

Returns:

fig – The plt.figure() object

Return type:

plt.figure()