I have a list of of genes, that are grouped at different levels (3 in my case). I can easily plot the treemap with the following (Gene Count set to 1 to equal the size):
fig = px.treemap(Ontology_genes, path=['Level 1', 'Level 2', 'Level 3', 'Gene'], values='Gene Count') fig.update_layout(uniformtext_mode='hide') fig.show()
But I’d like each gene tile to be a rectangle I can later color-code for an attribute. I can parse:
fig.update_traces(tiling_packing = "dice-slice")
But was hoping to figure out a way to control either all levels, i.e. “dice-squarify-squarify-slice” or just the last level - ‘Gene’ - and preset a fixed rectangle size.
I’ve consulted https://plotly.com/python/reference/treemap/#treemap-tiling and https://github.com/d3/d3-hierarchy#treemap-tiling, but I cannot figure out if this is possible, and if so, how.
Thanks for any help.