barcode#
- barcode(feature_persistence, visualise_dimension='all', ax=None, cmap='tab10', linewidth=2, figure_kwargs={})#
Plots a barcode diagram for the given feature persistence data.
Barcode diagrams are a way to visualise the persistence of features in topological data analysis where the x-axis represents the birth time and the y-axis represents the feature number. The length of each line segment in the barcode represents the persistence of a feature, with longer segments indicating more persistent features.
- Parameters:
- feature_persistencedict
A dictionary containing persistence diagrams. The dictionary should have a key ‘dgms’ which maps to a list of arrays, each representing a persistence diagram for a different homology dimension.
- visualise_dimensionstr, int, optional
Select which homology dimension to visualise. If ‘all’ is provided, all dimensions are plot. Default is ‘all’.
- axmatplotlib.axes.Axes, optional
The axes on which to plot the barcode. If None, a new figure and axes will be created. Default is None.
- cmapstr, optional
Colormap to use for the plot. Default is ‘tab10’.
- linewidthfloat, optional
Width of the barcode lines. Default is 2.
- figure_kwargsdict, optional
Additional keyword arguments to pass to
plt.figure
when creating a new figure. Default is {}.
- 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.
- TypeError
If marker_size is not an int or float. If feature_persistence is not a dictionary with a ‘dgms’ key.