Persistence graphical tools reference manual#

gudhi.plot_persistence_barcode(persistence=[], persistence_file='', alpha=0.6, max_intervals=20000, inf_delta=0.1, legend=None, colormap=None, axes=None, fontsize=16)[source]#

This function plots the persistence bar code from persistence values list , a np.array of shape (N x 2) (representing a diagram in a single homology dimension), or from a persistence diagram file.

Parameters:
  • persistence (an array of (dimension, (birth, death)) or an array of (birth, death)) – Persistence intervals values list. Can be grouped by dimension or not.

  • persistence_file (string) –

    A persistence diagram file style name (reset persistence if both are set).

  • alpha (float) – barcode transparency value (0.0 transparent through 1.0 opaque - default is 0.6).

  • max_intervals (int) – maximal number of intervals to display. Selected intervals are those with the longest life time. Set it to 0 to see all. Default value is 20000.

  • inf_delta (float) – Infinity is placed at ((max_death - min_birth) x inf_delta) above max_death value. A reasonable value is between 0.05 and 0.5 - default is 0.1.

  • legend (boolean or None) – Display the dimension color legend. Default is None, meaning the legend is displayed if dimension is specified in the persistence argument, and not displayed if dimension is not specified.

  • colormap (tuple of colors (3-tuple of float between 0. and 1.)) – A matplotlib-like qualitative colormaps. Default is None which means matplotlib.cm.Set1.colors.

  • axes (matplotlib.axes.Axes) – A matplotlib-like subplot axes. If None, the plot is drawn on a new set of axes.

  • fontsize (int) – Fontsize to use in axis.

Returns:

(matplotlib.axes.Axes): The axes on which the plot was drawn.

gudhi.plot_persistence_diagram(persistence=[], persistence_file='', alpha=0.6, band=0.0, max_intervals=1000000, inf_delta=0.1, legend=None, colormap=None, axes=None, fontsize=16, greyblock=True)[source]#

This function plots the persistence diagram from persistence values list, a np.array of shape (N x 2) representing a diagram in a single homology dimension, or from a persistence diagram file`.

Parameters:
  • persistence (an array of (dimension, (birth, death)) or an array of (birth, death)) – Persistence intervals values list. Can be grouped by dimension or not.

  • persistence_file (string) –

    A persistence diagram file style name (reset persistence if both are set).

  • alpha (float) – plot transparency value (0.0 transparent through 1.0 opaque - default is 0.6).

  • band (float) – band (not displayed if \(\leq\) 0. - default is 0.)

  • max_intervals (int) – maximal number of intervals to display. Selected intervals are those with the longest life time. Set it to 0 to see all. Default value is 1000000.

  • inf_delta (float) – Infinity is placed at ((max_death - min_birth) x inf_delta) above max_death value. A reasonable value is between 0.05 and 0.5 - default is 0.1.

  • legend (boolean or None) – Display the dimension color legend. Default is None, meaning the legend is displayed if dimension is specified in the persistence argument, and not displayed if dimension is not specified.

  • colormap (tuple of colors (3-tuple of float between 0. and 1.)) – A matplotlib-like qualitative colormaps. Default is None which means matplotlib.cm.Set1.colors.

  • axes (matplotlib.axes.Axes) – A matplotlib-like subplot axes. If None, the plot is drawn on a new set of axes.

  • fontsize (int) – Fontsize to use in axis.

  • greyblock (boolean) – if we want to plot a grey patch on the lower half plane for nicer rendering. Default True.

Returns:

(matplotlib.axes.Axes): The axes on which the plot was drawn.

gudhi.plot_persistence_density(persistence=[], persistence_file='', nbins=300, bw_method=None, max_intervals=1000, dimension=None, cmap=None, legend=True, axes=None, fontsize=16, greyblock=False)[source]#

This function plots the persistence density from persistence values list, np.array of shape (N x 2) representing a diagram in a single homology dimension, or from a persistence diagram file. Be aware that this function does not distinguish the dimension, it is up to you to select the required one. This function also does not handle degenerate data set (scipy correlation matrix inversion can fail).

Requires:

SciPy

Parameters:
  • persistence (an array of (dimension, (birth, death)) or an array of (birth, death)) – Persistence intervals values list. Can be grouped by dimension or not.

  • persistence_file (string) –

    A persistence diagram file style name (reset persistence if both are set).

  • nbins (int) – Evaluate a gaussian kde on a regular grid of nbins x nbins over data extents (default is 300)

  • bw_method (str, scalar or callable, optional) – The method used to calculate the estimator bandwidth. This can be ‘scott’, ‘silverman’, a scalar constant or a callable. If a scalar, this will be used directly as kde.factor. If a callable, it should take a gaussian_kde instance as only parameter and return a scalar. If None (default), ‘scott’ is used. See scipy.stats.gaussian_kde documentation for more details.

  • max_intervals (int) – maximal number of points used in the density estimation. Selected intervals are those with the longest life time. Set it to 0 to see all. Default value is 1000.

  • dimension (int) – the dimension to be selected in the intervals (default is None to mix all dimensions).

  • cmap (cf. matplotlib colormap) – A matplotlib colormap (default is matplotlib.pyplot.cm.hot_r).

  • legend (boolean) – Display the color bar values (default is True).

  • axes (matplotlib.axes.Axes) – A matplotlib-like subplot axes. If None, the plot is drawn on a new set of axes.

  • fontsize (int) – Fontsize to use in axis.

  • greyblock (boolean) – if we want to plot a grey patch on the lower half plane for nicer rendering. Default False.

Returns:

(matplotlib.axes.Axes): The axes on which the plot was drawn.