summaryrefslogtreecommitdiff
path: root/src/cython/doc/persistence_graphical_tools_user.rst
blob: b2124fddef465661e6faec3e6f2e9b8989bbcfb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
:orphan:

.. To get rid of WARNING: document isn't included in any toctree

Persistence graphical tools user manual
=======================================
Definition
----------
.. include:: persistence_graphical_tools_sum.inc


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::
   :include-source:

    import gudhi

    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::
   :include-source:

    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'
    plt = gudhi.plot_persistence_diagram(persistence_file=persistence_file,
        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::
   :include-source:

    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'
    plt = gudhi.plot_persistence_density(persistence_file=persistence_file,
        max_intervals=0, dimension=1, legend=True)
    plt.show()