Skip to content

Clustergram obscures lengthy row labels with colour scale bar  #771

@kamurani

Description

@kamurani

I am using Clustergram figures in a Jupyter notebook. When plotting the clusters calculated from a dataframe, I have some long column / row names that I need to show in the figure as labels.

However, the colour scale bar is not automatically adjusted to move to the right to accommodate the extra space taken up by longer text in the row labels.

To Reproduce

import pandas as pd
import dash_bio
example_df = pd.read_csv('https://git.io/clustergram_brain_cancer.csv').set_index('ID_REF')

# add row names 
row_prefix = "A really long name for a row / column"
example_df.index = [f"{row_prefix} {i}" for i in example_df.index]

fig = dash_bio.Clustergram(
    data=example_df,
    row_labels=list(example_df.index),
)
fig.show()

This gives me:
image

Expected behavior
The plot should detect the sizing of row / column labels, and if there is enough room (which there is in this case), the colour scale bar should position itself outside the range of this text.

Alternatively, there should be a way to disable the colour bar to prevent obscuring the labels (I have been unable to get this working either with Clustergram)

E.g.

fig.update_coloraxes(showscale=False) # this does not remove anything from the `Clustergram` figure. 

Versions

Python 3.12.2

>>>print(dash_bio.__version__)
1.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions