diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2020-05-25 17:45:22 +0200 |
---|---|---|
committer | Marc Glisse <marc.glisse@inria.fr> | 2020-05-25 17:45:22 +0200 |
commit | ee56ee7814367c8b7437c8a8d9a0be32877c3196 (patch) | |
tree | 535d418e3e6e8d6b358afd8130f2a36d6f72c819 /src/python/gudhi/clustering/tomato.py | |
parent | 8c122a8c92285dd89844720c9cf04d001db491d0 (diff) |
plotting almost empty diagrams
Diffstat (limited to 'src/python/gudhi/clustering/tomato.py')
-rw-r--r-- | src/python/gudhi/clustering/tomato.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/python/gudhi/clustering/tomato.py b/src/python/gudhi/clustering/tomato.py index 2b4d9242..824b5544 100644 --- a/src/python/gudhi/clustering/tomato.py +++ b/src/python/gudhi/clustering/tomato.py @@ -222,21 +222,19 @@ class Tomato: """ import matplotlib.pyplot as plt + l = self.max_density_per_cc_.min() + r = self.max_density_per_cc_.max() if self.diagram_.size > 0: plt.plot(self.diagram_[:, 0], self.diagram_[:, 1], "ro") - l = self.diagram_[:, 1].min() - r = max(self.diagram_[:, 0].max(), self.max_density_per_cc_.max()) - else: - l = self.max_density_per_cc_.min() - r = self.max_density_per_cc_.max() - #FIXME: move this out of the else, for diagrams with one point on the diagonal and an infinite point with the same coordinate? - if l == r: - if l > 0: - l, r = .9 * l, 1.1 * r - elif l < 0: - l, r = 1.1 * l, .9 * r - else: - l, r = -1., 1. + l = min(l, self.diagram_[:, 1].min()) + r = max(r, self.diagram_[:, 0].max()) + if l == r: + if l > 0: + l, r = .9 * l, 1.1 * r + elif l < 0: + l, r = 1.1 * l, .9 * r + else: + l, r = -1., 1. plt.plot([l, r], [l, r]) plt.plot( self.max_density_per_cc_, numpy.full(self.max_density_per_cc_.shape, 1.1 * l - 0.1 * r), "ro", color="green" |