Skip to content

Commit 822c9ca

Browse files
authored
Merge pull request #50 from vonpost/master
Made default labels in plot_diagrams correspond to the number of diagrams
2 parents 49d2939 + 22554bd commit 822c9ca

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

RELEASE.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
0.2.1
2+
- Allowed for more than 9 diagram labels in plot_persistence_diagrams.
3+
14
0.2.0
25
- New full featured implementation of Persistence Images.
36
- Legacy PersImage now deprecated.

persim/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.0"
1+
__version__ = "0.2.1"

persim/visuals.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,14 @@ def plot_diagrams(
6767

6868
xlabel, ylabel = "Birth", "Death"
6969

70-
if labels is None:
71-
# Provide default labels for diagrams if using self.dgm_
72-
labels = [
73-
"$H_0$",
74-
"$H_1$",
75-
"$H_2$",
76-
"$H_3$",
77-
"$H_4$",
78-
"$H_5$",
79-
"$H_6$",
80-
"$H_7$",
81-
"$H_8$",
82-
]
83-
8470
if not isinstance(diagrams, list):
8571
# Must have diagrams as a list for processing downstream
8672
diagrams = [diagrams]
8773

74+
if labels is None:
75+
# Provide default labels for diagrams if using self.dgm_
76+
labels = ["$H_{{{}}}$".format(i) for i , _ in enumerate(diagrams)]
77+
8878
if plot_only:
8979
diagrams = [diagrams[i] for i in plot_only]
9080
labels = [labels[i] for i in plot_only]
@@ -281,4 +271,4 @@ def wasserstein_matching(I1, I2, matchidx, palette=None, labels=["dgm1", "dgm2"]
281271
else:
282272
plt.plot([I1[i, 0], I2[j, 0]], [I1[i, 1], I2[j, 1]], "g")
283273

284-
plot_diagrams([I1, I2], labels=labels, ax=ax)
274+
plot_diagrams([I1, I2], labels=labels, ax=ax)

0 commit comments

Comments
 (0)