Persistence graphical tools user manual


Author:Vincent Rouvreau
Introduced in:GUDHI 2.0.0
Copyright:GPL v3
These graphical tools comes on top of persistence results and allows the user to build easily barcode and persistence diagram.
Persistence graphical tools user manual Persistence graphical tools reference manual

Show persistence as a barcode

This function can display the persistence result as a barcode:

import gudhi

perseus_file = gudhi.__root_source_dir__ + '/data/bitmap/3d_torus.txt'
periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file=perseus_file)
diag = periodic_cc.persistence()
print("diag = ", diag)
plt = gudhi.plot_persistence_barcode(diag)

Show persistence as a diagram

This function can display the persistence result as a diagram:

import gudhi

# rips_on_tore3D_1307.pers obtained from write_persistence_diagram method
persistence_file=gudhi.__root_source_dir__ + \
plt = gudhi.plot_persistence_diagram(persistence_file=persistence_file,

If you want more information on a specific dimension, for instance:

import gudhi

persistence_file=gudhi.__root_source_dir__ + \
diag = \
dim = 1
# Display all points with some transparency
plt = gudhi.plot_persistence_diagram([(dim,interval) for interval in diag[dim]],
    max_plots=0, alpha=0.1)