Is it possible to disable zoom in/out event in treemap?

I’d like to disable zoom in/out event in treemap or want to show only the parent labels but It’s kind of tricky

1 Like

hi @jun1332
welcome to the community. I am not sure what you’re trying to do. For example in this treemap:

you would like to see only the gray Eve but nothing else?

I think the original poster was asking if it’s possible to disable the click event zoom that’s baked into the treemap figure.
If you were to click on one of the leaf nodes then the plot will zoom in completely to show just that leaf node.

I am looking to disable this feature (or at least override the click event). Is this possible?

Maybe these arguments are what you are looking for?

Thanks! It seems the maxdepth is related to rendering. So a maxdepth of -1 will show all levels in the hierarchy, whereas 1 will show just the top level. However either way, the zoom click event is still active.

The level is the same except it’s not numerically set, but with the name of the level (as far as I can tell).

A Google search brought me here with the same question.
ie. I want to get rid of the click event that causes the figure to zoom into the item that was clicked. At the same time, I want the figure to be responsive to window sizes, so I’m trying to avoid using fig.to_image().

So far, I tried

fig.to_html(config={"staticPlot": True})

or

fig.update_layout(clickmode='none')

but neither of them works from Python.

struckthrough (see below)

Using this option in plotly.js seems to work in this demo but passing "staticPlot"=True with plotly.py only seems to get rid of the mode bar.
Edit: I tried {staticPlot:true} with plotly.js and without plotly.py and it seems that this option isn’t supported with treemaps. It would be nice if it is …

clickmode='none' doesn’t seem to do anything.

I thought the above options are created with this goal in mind.
Could this be a bug? (FYI I’m using Python 3.10, plotly.py 5.10, plotly.js 2.14)

It looks like this has been fixed as of plotly.js-2.15.0.
(merged 2 days after I posted the reply above, but the bug seems to have been identified a few weeks before)

Using

fig.to_html(config={"staticPlot": True})

now works. Thanks, plotly.js team!