I was using colab and trying to use plotly but it doesn’t show anything no error but no plot as well, it just expand the output as it’s showing it but nothing. I though maybe it theme extension but I uninstalled it and nothing.
import cufflinks as cf
import plotly.express as px
import plotly.graph_objects as go
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
init_notebook_mode(connected=True)
cf.go_offline()
df_stocks = px.data.stocks()
px.line(df_stocks, x='date', y='GOOG', labels={'x':'Date', 'y':'Price'})
Goldeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
From your code above you didn’t explicitly ensure the renderer
you are using. The renderer lets the Plotly know which environment to display the plot. You must pass it as a string either as a colab or notebook
.
figure = px.line(df_stocks, x='date', y='GOOG', labels={'x':'Date', 'y':'Price'})
figure.show(renderer='colab') # or use this instead; figure.show(renderer='notebook')
2