molplotly icon indicating copy to clipboard operation
molplotly copied to clipboard

Saving interactive plots

Open jannisborn opened this issue 2 years ago • 3 comments

Thanks for the great package!

It would be fantastic if the interactive plots could be exported/saved. I understand that this is non-trvial in plotly, but other libraries like mpl3d also allow to export as interactive HTML or SVG. See here for an exemplary plot. Also TMAP and Faerun support this natively. I think it will be a heavily sought-after feature for real usability of this package.

Possible solutions:

  • separate integration building on top of mpl3d (seems overkill, might be the last resort)
  • Building upon this gist to export the Dash as HTML: https://gist.github.com/exzhawk/33e5dcfc8859e3b6ff4e5269b1ba0ba4
  • Faerun-style solution, see here: https://github.com/reymond-group/faerun-python

jannisborn avatar Feb 16 '22 12:02 jannisborn

Thanks for the suggestions! I agree that being able to save plots would make a huge difference - hopefully it's possible to build upon the gist you linked and include the molecule images by generating them all in one go (right now they are created on-the-fly). Will let you know how it goes!

wjm41 avatar Feb 16 '22 13:02 wjm41

A way around this limitation which was suitable for our specific application was to set up a multi-user Jupiter Notebook server via JupiterHub server. There, a notebook can be run with the plots of interest using the following mode:

app.run_server(mode='jupyterlab',host='0.0.0.0', port=8050, height=800, debug=False, proxy=None, use_reloader=False)

The plot can then be seen in a new tab at your.server.adress.com:8050

The drawback is that you have to set up a server.

remseven avatar Apr 30 '22 14:04 remseven

Love molplotly but flexible integration in user pages would be great!

Could it be integrated along the lines of the plot() functionality of plotly.offline. The plot() function can be used to generate eg. a

html section. This can be easily plugged into a user html page without need for additional servers (I use it with Django a lot - just dump it into a page).

Can see the memory issues, but I'll live with that...

Also - is there documentation of the run_server() function? Is there a timeout option perhaps - I can start a run_server process but how do I terminate these after a set time if I have multiple users generating multiple plots.

shortydutchie avatar Aug 31 '23 09:08 shortydutchie