Heatmap with dendrogram not working


I am trying to replicate the sample here…

I get this error…

AttributeError Traceback (most recent call last)
in ()
11 # Add Side Dendrogram Data to Figure
—> 12 figure[‘data’].extend(dendro_side[‘data’])
14 # Create Heatmap

AttributeError: ‘tuple’ object has no attribute ‘extend’

At this point, the figure[‘data’] and the dendro_side[‘data’] are both tuples, not lists, so extend will not work.

I have tried this instead.

figure['data'] = figure['data'] + dendro_side['data']

But then I get another error.

ValueError: The data property of a figure may only be assigned a list or tuple that contains a permutation of a subset of itself

What is the right pattern here?


Ok figured it out. Figure () has methods for adding traces.


Happy to raise a PR if somebody can point out the location of the doco


I do actually have quite a fancy full working example of a Clustermap with configuration options for row/column dendrograms etc… where is the right place to share something like this?


I was going to do a figurefactory and PR but I haven’t gotten around to it.


Hi @mdausmann-cmri,

Yeah, that example is out of date. Thanks for pointing it out. Could you raise an issue on the documentation repo here at https://github.com/plotly/documentation/tree/source-design-merge ?

And, if you’re so inclined a PR with the notebook fixed would be appreciated!

Also, your clustermap solution sounds nice. I’d recommend making it a gist (https://gist.github.com/) and then creating a new forum thread with the link and some examples and screenshots. This could be a nice way to get some feedback from the community and even start down the path towards making it a figure factory.



If you don’t mind sharing, I’d really appreciate being able to work from your example.