persistence_image#
- persistence_image(feature_persistence, visualise_dimension=1, bw_method=None, mesh_steps=50, interpolation_method='gaussian', show_points=True, ax=None, cmap='binary', vmin=None, vmax=None, marker_size=100, figure_kwargs={}, scatter_kwargs={}, shape_kwargs={})#
Visualise the persistence image of a given feature persistence diagram.
A persistence image is a 2D heatmap representation of the persistence diagram, where the x-axis represents the birth times and y-axis represents the persistence (death-birth) of features. The density of points in the persistence diagram is represented by the intensity of the color in the heatmap.
The individual points of the persistence diagram can be shown on top of the heatmap, and the density of the points is estimated using a Gaussian kernel density estimation.
- Parameters:
- feature_persistencedict
A dictionary containing persistence diagrams. The key ‘dgms’ should map to a list of diagrams.
- visualise_dimensionint, optional
The dimension of the persistence diagram to visualize. Default is 1.
- bw_methodfloat, optional
The bandwidth for the Gaussian kernel density estimation. If None, the scott bandwidth method is used.
- mesh_stepsint, optional
The number of steps in x and y direction of the meshgrid. Default is 50.
- interpolation_methodstr, optional
The method applied for interpolation of the heatmap passed into Matplotlib imshow(). If no interplotation required, select None. Default is ‘gaussian’.
- show_pointsbool, optional
Whether to show the points of the persistence diagram on the plot. Default is True.
- axmatplotlib.axes.Axes, optional
The axes on which to plot. If None, a new figure and axes are created.
- cmapstr, optional
The colormap to use for the density plot. Default is ‘viridis’.
- vminfloat, optional
The minimum data value that corresponds to the colormap’s lower bound. Default is None.
- vmaxfloat, optional
The maximum data value that corresponds to the colormap’s upper bound. Default is None.
- marker_sizeint or float, optional
The size of the markers for the points. Default is 100.
- figure_kwargsdict, optional
Additional keyword arguments to pass to plt.figure when creating a new figure. Default is None.
- scatter_kwargsdict, optional
Additional keyword arguments for Matplotlib scatter plot.
- shape_kwargsdict, optional
Dictionary of arguments which get passed to matplotlib.patches.PathPatch when drawing shapes
- Returns:
- figmatplotlib.figure.Figure
The figure object containing the plot.
- axmatplotlib.axes.Axes
The axes object containing the plot.
- Raises:
- ValueError
If marker_size is not a positive number or if visualise_dimension is not an integer.
- TypeError
If marker_size is not an int or float.