summaryrefslogtreecommitdiff
path: root/src/cython/doc/persistence_graphical_tools_user.rst
diff options
context:
space:
mode:
Diffstat (limited to 'src/cython/doc/persistence_graphical_tools_user.rst')
-rw-r--r--src/cython/doc/persistence_graphical_tools_user.rst37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/cython/doc/persistence_graphical_tools_user.rst b/src/cython/doc/persistence_graphical_tools_user.rst
index 292915eb..b2124fdd 100644
--- a/src/cython/doc/persistence_graphical_tools_user.rst
+++ b/src/cython/doc/persistence_graphical_tools_user.rst
@@ -12,6 +12,9 @@ Definition
Show persistence as a barcode
-----------------------------
+.. note::
+ this function requires matplotlib and numpy to be available
+
This function can display the persistence result as a barcode:
.. plot::
@@ -19,16 +22,22 @@ 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)
- plt.show()
+ off_file = gudhi.__root_source_dir__ + '/data/points/tore3D_300.off'
+ point_cloud = gudhi.read_off(off_file=off_file)
+
+ rips_complex = gudhi.RipsComplex(points=point_cloud, max_edge_length=0.7)
+ simplex_tree = rips_complex.create_simplex_tree(max_dimension=3)
+ diag = simplex_tree.persistence(min_persistence=0.4)
+
+ plot = gudhi.plot_persistence_barcode(diag)
+ plot.show()
Show persistence as a diagram
-----------------------------
+.. note::
+ this function requires matplotlib and numpy to be available
+
This function can display the persistence result as a diagram:
.. plot::
@@ -43,6 +52,12 @@ This function can display the persistence result as a diagram:
legend=True)
plt.show()
+Persistence density
+-------------------
+
+.. note::
+ this function requires matplotlib, numpy and scipy to be available
+
If you want more information on a specific dimension, for instance:
.. plot::
@@ -50,13 +65,9 @@ If you want more information on a specific dimension, for instance:
import gudhi
+ # rips_on_tore3D_1307.pers obtained from write_persistence_diagram method
persistence_file=gudhi.__root_source_dir__ + \
'/data/persistence_diagram/rips_on_tore3D_1307.pers'
- diag = \
- gudhi.read_persistence_intervals_grouped_by_dimension(persistence_file=\
- persistence_file)
- 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)
+ plt = gudhi.plot_persistence_density(persistence_file=persistence_file,
+ max_intervals=0, dimension=1, legend=True)
plt.show()