Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Initial svg height before window resize

I’m running into an issue where plots always load at a height of 450px, no matter the size of the div. I don’t have any problem using Plotly.resize() within window.addEventListener('resize', function() {}, but can’t seem to get the plot height to adjust without a window resize.

The attached image shows the actual div height and chart height when loading in a narrow screen. The same thing happens at wider screens where the div is larger than 450px.

Is there any reason the plot would respect container width, but not height? Is this a bug or something I can adjust?

There must a race condition somewhere in your code. Can you share a snippet with us?

I figured it out. The plot is being inserted into a container that has a height of 0 before the plot loads. Plotly seems to default to a height of 450px.

1 Like

That’s correct, the default height setting is 450px.