I need to get the heights of the nodes off a dendrogram my plan was to use the dcoord/icoord but physically regarding the heights from the resulting plot and the values in the respective 2d arrays.
according to this post, dcoord and icoord reflect the coordinates of the nodes in the tree. in the scipy.cluster.hierarchy.dendrogram documentation, the meaning of icoord/dcoord are pretty nondescript. so im not able to backtrack what's going on
would appreciate any insights
import numpy as np
import pandas as pd
from scipy.cluster import hierarchy
import matplotlib.pyplot as plt
data = [[24, 16], [13, 4], [24, 11], [34, 18], [41,
6], [35, 13]]
frame = pd.DataFrame(np.array(data),
columns=["a", "b"],
index=["Atlanta", "Boston", "Chicago", "Dallas", "Denver", "Detroit"])
Z = hierarchy.linkage(frame, 'single')
plt.figure()
dn = hierarchy.dendrogram(Z, labels=frame.index)
the heights would be something like [15, 10, 9, 5], but I want python to give this array to me, not me eyeballing it.