✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Plotly plots are not showing on Jupyter Notebook even after fig.show()?

This happened suddenly, it was working just fine before. I’m trying to convert the Jupyter notebook to HTML so I can use it for my website. Everything was working fine until a few days ago I assume, then today I tried to download my notebook as HTML and no plots were showing on HTML version.

Now then, I went back to my notebook to re-generate all plots, all of sudden, no plots are showing. Below is the code for one of my plot:

fig = px.sunburst(top10_trump_support, path=['State','County'], values='Trump Share', color='Trump Share',
                  color_continuous_scale='OrRd', title='Top 10 Trump Support County and State',
                  hover_data=['Trump Share'])
fig.update_layout(coloraxis_colorbar_title='Trump Share')
fig.update_traces(hovertemplate="Trump Share: %{customdata[0]}")

Also, my previous visualization with Plotly on Jupyter notebook (that I created a few days ago) works still fine, so I assume I only have a problem with this particular notebook? What could be the reason and how can I fix this issue? Thank you in advance!

That’s weird. Try to create a new notebook and copy-paste this code in that notebook. See if that works. If not, what error do you get?

I think I had an error… I tried a few days later, and it’s working fine now! Still don’t know why this happened but… glad it got solved. Haha. Thanks!