Skip to content

Commit 3d4141a

Browse files
DAWellscatanzaromj
authored andcommitted
Visuals use supplied ax
Fixes a bug in bottleneck_matching and wasserstein_matching so now they plot to the supplied ax when i == -1
1 parent 81285fe commit 3d4141a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

persim/visuals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def bottleneck_matching(dgm1, dgm2, matching, labels=["dgm1", "dgm2"], ax=None):
223223
if i == -1:
224224
diagElem = np.array([dgm2Rot[j, 0], 0])
225225
diagElem = diagElem.dot(R.T)
226-
plt.plot([dgm2[j, 0], diagElem[0]], [dgm2[j, 1], diagElem[1]], c, linewidth=linewidth, linestyle=linestyle)
226+
ax.plot([dgm2[j, 0], diagElem[0]], [dgm2[j, 1], diagElem[1]], c, linewidth=linewidth, linestyle=linestyle)
227227
elif j == -1:
228228
diagElem = np.array([dgm1Rot[i, 0], 0])
229229
diagElem = diagElem.dot(R.T)
@@ -277,7 +277,7 @@ def wasserstein_matching(dgm1, dgm2, matching, labels=["dgm1", "dgm2"], ax=None)
277277
if i == -1:
278278
diagElem = np.array([dgm2Rot[j, 0], 0])
279279
diagElem = diagElem.dot(R.T)
280-
plt.plot([dgm2[j, 0], diagElem[0]], [dgm2[j, 1], diagElem[1]], "g")
280+
ax.plot([dgm2[j, 0], diagElem[0]], [dgm2[j, 1], diagElem[1]], "g")
281281
elif j == -1:
282282
diagElem = np.array([dgm1Rot[i, 0], 0])
283283
diagElem = diagElem.dot(R.T)

0 commit comments

Comments
 (0)