Plotly div does not take full available height

When getting the div of a plotly (python) chart with responsive set to True, and inserting it into an HTML file the chart takes the full width but not the full available height. The plotly div is placed into a parent div with width 100% and height 100%, and the plotly JS is included (tried both CDN version and JS as part of the DIV).

Is there anything else that needs to be done to achieve the same chart behaviour as when generating the HTML chart by plotly itself?

Hi @drex891mt,

That sounds like it should be enough. Here is the Python code for building the div: https://github.com/plotly/plotly.py/blob/6a85e4b7b6510d58d6f4525de179a45339aa297c/plotly/io/_html.py#L302-L324.

Have you double checked that the figure doesn’t define it’s own height in fig.layout.height? If this were set to an explicit value, then responsive: true would not override it.

-Jon

1 Like

Hi @jmmease,

Thanks for your feedback. Yes checked that, there is no value for fig.layout.height (and fig.layout.width).

A