✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Assigning colours to groups of rows/columns in Python Plotly heatmaps

Is there a way to use plotly in Python to generate a heatmap (e.g., through imshow ) and assign different colours to different groups of rows/columns? The goal is to generate a plot similar to the clustermap that can be generated with seaborn without dendrograms but with external colours of the rows/columns to indicate distinct groups, as shown in the example attached here below and obtained from seaborn’s documentation where rows are assigned with different colours for indicating species .

In particular, is there a solution to this using plotly.express and starting from (or using directly) data within a pandas 's DataFrame ? Also, ideally can this column be separated from the main heatmap?