-
-
Notifications
You must be signed in to change notification settings - Fork 191
Description
When interacting with the clustergram (such as using the zoom or pan features) the dendrogram and heatmap behave independently. So when I zoom in on a selected section of the heatmap, the section of the dendrogram that is displayed beside the heatmap does not correspond to the rows of the heatmap.
import numpy as np
import pandas as pd
import dash_bio as dashbio
# make some random data with 4 clusters of 5 vectors with some noise
data = np.random.normal(0,0.5, [20,100])
vec = np.random.uniform(size=[100])
for ii in range(len(data)):
data[ii,:] += vec
if ii %5 == 4:
vec = np.random.normal(size=[100])
df = pd.DataFrame(data)
clustergram = dashbio.Clustergram(
data=df,
column_labels=list(df.columns),
row_labels=list(df.index),
hidden_labels=['col'],
display_ratio=[0.15,0],
link_method='average',
col_dist='cosine',
row_dist='cosine',
color_threshold={
'row': 0.6,
'col': 100
}
)
This code produces the following clustergram:
When I select the top maroon cluster (including vectors 3,1,4,0,2) by using the zoom tool on the heatmap, as shown below:
The zoomed image (below) shows the correct vectors (3,1,4,0,2) but instead of showing the maroon portion of the dendrogram it shows a half blue and half red portion from the middle section of the dendrogram.
Also, if I select the maroon section of the dendrogram to zoom into using the selection tool, as shown below:
The zoomed image correctly shows the maroon section of the dendrogram, but did not zoom in on the correct portion of the heatmap, it shows vectors 7, 5, 9, 11, 10, and 12 from the middle section of the heatmap instead of the vectors that correspond to the maroon cluster (vectors 3,1,4,0,2).
This problem also occurs with the interactive pan feature where if you click and drag either the heatmap or the dendrogram, the other doesn't move in unison.
Is this just me or does anyone else have this issue?
Also, let me know if there is something i can do in my code to connect the two graphs so they move together when using the interactive features.
Python version: 3.13.2
dash 2.14.2 py313h06a4308_0
dash-bio 1.0.1 pyhd8ed1ab_0 conda-forge
dash-core-components 2.0.0 py313h06a4308_0
dash-html-components 2.0.0 py313h06a4308_0
dash-table 5.0.0 py313h06a4308_0
plotly 6.0.1 py313h7040dfc_0
pandas 2.2.3 py313h6a678d5_0
numpy 2.1.2 pypi_0 pypi
numpy-base 2.2.4 py313h3fc9231_0