Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying Plotly figures in full screen in Jupyter notebooks

I have large Plotly figures and tables in my Jupyter Notebook and Sphinx-based documentation. Because the documentation page is already crowded, I would like to give the user an option to

  • Display these figures in a full-screen pop-up

or

  • Make tables scrollable instead of compressed columns, as the table layout with many columns do not work when embedded on a page

An example of a broken layout:

enter image description here

Does Plotly.py offer ways to achieve this easily? If it doesn't, can I somehow include external JavaScript on the generated Sphinx documentation page for the same effect?

like image 776
Mikko Ohtamaa Avatar asked Oct 17 '25 00:10

Mikko Ohtamaa


1 Answers

I would suggest two solutions and I wish one of these solution at least works for you:

  • Horizontal Scrollbar: deactivate the autosizing option and choose a larger value for the width:

    fig.update_layout(autosize=False, width=2000)
    
  • Full-screen mode: activate the autosizing along with pop the plot up in a browser mode:

     fig.update_layout(autosize=True) # remove height=800
     fig.show(renderer="browser")  # remove display(fig)
    
like image 62
Phoenix Avatar answered Oct 20 '25 07:10

Phoenix



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!