1
votes

I understand that it is possible to export a Plotly graph, and that I can display it.

While sharing notebooks, the matplotlib plots remain intact in the Jupyter Notebooks, however, the Plotly graphs do not. They simply disappear

I understand that the Plotly graph is browser rendered, but is there any way I can store the graph in the ipynb file when I export it?

Is there any way that I can display the Plotly graph, just like the matplotlib graph?

What I’m trying to achieve

Edit: As suggested in an answer, I tried to save it to a figure object, and display that, but no luck there either :/

I tried to use an object to store it as well

1

1 Answers

-1
votes

enter image description hereIf you put the code for a series of graphs in a single cell, execute it and save it, I think it will be displayed the next time you open it.

import plotly.express as px
df = px.data.iris() # iris is a pandas DataFrame
fig = px.scatter(df, x="sepal_width", y="sepal_length")
fig.show()