Open wangjiawen2013 opened 11 months ago
Could you share an example and the error it produces? I cannot reproduce it, e.g - using the dataset from the other issue you posted works without issues:
x, y = np.meshgrid(range(-5, 5), range(-5, 5))
z = x ** 2 + y ** 2
#Convert this grid to columnar data expected by Altair
source = pd.DataFrame({'x': x.ravel(),
'y': y.ravel(),
'z': z.ravel()})
df = source.pivot(columns='y',index='x',values='z')
column_linkage_matrix = sch.linkage(df.drop_duplicates(), method='single', metric='euclidean')
column_flat_clusters = sch.fcluster(column_linkage_matrix, t=0, criterion='distance')
column_cl_data = idendrogram.ClusteringData(
linkage_matrix = column_linkage_matrix,
cluster_assignments = column_flat_clusters
)
column_idd = idendrogram.idendrogram()
column_idd.set_cluster_info(column_cl_data)
column_dendrogram = column_idd.create_dendrogram(truncate_mode=None).plot(
backend='altair',
orientation='top',
height=30, width=200,
show_nodes=False).interactive()
column_dendrogram
I know why. I thought it was caused by truncate_mode=None, but it's the same error caused by duplicates. When the duplicated data was removed, truncate=None worked well.
Hi, truncate_mode=None will cause error when creating_dendrogram using idd.create_dendrogram(truncate_mode=None)