-
-
Notifications
You must be signed in to change notification settings - Fork 193
Description
Describe the bug
When using the row_colors and column_colors parameters for the Clustergram component, the colored annotation bars do not zoom in sync with the heatmap. Specifically, when a user zooms into a region of the heatmap, the color bars remain at their original scale instead of zooming to match the selected subgrid region. This makes it quite difficult to identify which color annotations correspond to the zoomed data, especially for larger clustergrams.
To Reproduce
Steps to reproduce the behavior:
- Create a default Clustergram with some mock data and
row_colorsandcolumn_colorsset to some arrays of values, e.g.:
import pandas as pd
from dash import Dash, html, dcc
import dash_bio as dashbio
app = Dash(__name__)
df = pd.read_csv('https://git.io/clustergram_brain_cancer.csv').set_index('ID_REF')
rows = list(df.index)[:15]
column_colors = ['red', 'blue', 'green', 'yellow', 'purple',
'orange', 'pink', 'cyan', 'magenta', 'brown',
'red', 'blue', 'green', 'yellow', 'purple']
row_colors = ['red', 'blue', 'green', 'yellow', 'purple',
'orange', 'pink', 'cyan', 'magenta', 'brown',
'red', 'blue', 'green', 'yellow', 'purple',
'orange', 'pink', 'cyan', 'magenta', 'brown']
app.layout = html.Div([
dcc.Graph(figure=dashbio.Clustergram(
data=df.loc[rows].values,
column_colors=column_colors,
row_colors=row_colors,
color_threshold={
'row': 250,
'col': 700
},
height=800,
width=700
))
])
if __name__ == '__main__':
app.run(debug=True, port=8050)
- After opening on local host to launch the page, select any subsection of the heatmap portion of the Clustergram to zoom in, and you'll notice that the row colors and column colors do not also zoom proportionally. Example shown below under Screenshots with this code.
Expected behavior
When zooming into a region of the heatmap, the column_colors and row_colors annotation bars should zoom synchronously with the heatmap data, i.e. color blocks should scale and align with the visible columns/rows in the zoomed view.
Screenshots
Full default Clustergram example with row and column dendrogram colors before zooming:
After zooming to 2x5 subgrid:
Python version: [e.g., 3.7.2]
Python 3.13.5
Python environment (all installed packages in your current environment):
anyio 4.12.1
astroid 4.0.4
attrs 25.4.0
bio 1.8.1
biopython 1.86
biothings_client 0.4.1
blinker 1.9.0
certifi 2026.2.25
charset-normalizer 3.4.6
click 8.3.1
colour 0.1.5
dash 4.0.0
dash_bio 1.0.2
dill 0.4.1
flake8 7.3.0
Flask 3.1.3
GEOparse 2.0.4
gprofiler-official 1.0.0
h11 0.16.0
httpcore 1.0.9
httpx 0.28.1
idna 3.11
importlib_metadata 8.7.1
isort 8.0.1
itsdangerous 2.2.0
Jinja2 3.1.6
joblib 1.5.3
jsonschema 4.26.0
jsonschema-specifications 2025.9.1
MarkupSafe 3.0.3
mccabe 0.7.0
mygene 3.2.2
narwhals 2.18.0
nest-asyncio 1.6.0
numpy 2.4.3
packaging 26.0
pandas 3.0.1
ParmEd 4.3.1
periodictable 2.1.0
pip 25.1.1
platformdirs 4.9.4
plotly 6.6.0
pooch 1.9.0
pycodestyle 2.14.0
pyflakes 3.4.0
pylint 4.0.5
pyparsing 3.3.2
python-dateutil 2.9.0.post0
referencing 0.37.0
requests 2.32.5
retrying 1.4.2
rpds-py 0.30.0
scikit-learn 1.8.0
scipy 1.17.1
setuptools 82.0.1
six 1.17.0
threadpoolctl 3.6.0
tomlkit 0.14.0
tqdm 4.67.3
typing_extensions 4.15.0
urllib3 2.6.3
Werkzeug 3.1.6
zipp 3.23.0
Additional context
Add any other context about the problem here.