diff options
Diffstat (limited to 'src/python')
-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" |