iframe-sizeΒΆ

Source:

.. plotly:: 
   :iframe-width: 500px
   :iframe-height: 300px

   import plotly.express as px

   px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])

Output:

import plotly.express as px

px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])

(Source code, html)

You can set the default iframe-width and iframe-height by specifying plotly_iframe_width (default: "100%") and plotly_iframe_height (default: "500px") in conf.py.

# conf.py

plotly_iframe_width = "500px"
plotly_iframe_height = "300px"