question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

blank iplot in Jupyter Notebooks

See original GitHub issue

I’ve been having a persistent but intermittent issue with iplot in Juypyter notebooks where the plots are blank, but space is taken up in the Jupyter notebook output for them. It seems to happen most often in notebooks with large amounts of data and frequent replotting within the notebook.

it seems like there at least a few other people with the same issue, across multiple versions of both Jupyter Notebooks and Plotly, but I haven’t seen a definitive solution or explanation other than restarting computer/notebook, which does not always work in my case.

For what it’s worth, in my current Jupyter notebook I’m plotting a simple scatter plot and getting a blank layout:

xs = [0, 1, 2, 3, 4]
ys = [4, 3, 2, 1, 0]
trace = go.Scatter(
    x = xs,
    y = ys,
    mode = 'markers'
)
data = [trace]
py.iplot(data)

And here is the JS console output:


main.min.js:33264 actions jupyter-notebook:find-and-replace does not exist, still binding it in case it will be defined later...
MenuBar.bind_events @ main.min.js:33264
main.min.js:12429 load_extensions Arguments(2)
main.min.js:12406 Loading extension: export_embedded/main
:8888/nbextensions/export_embedded/main.js?v=20190304112619:22 Notebook version 5.1.0 or higher required for this extension
main.min.js:24777 Session: kernel_created (f1932fce-d600-4f9e-a9d9-f8b88e8ba223)
main.min.js:23933 Starting WebSockets: ws://localhost:8888/api/kernels/6fbd3818-f86b-4d80-92dd-34b08ff15ea0
:8888/static/plotly.js?v=20190304112619:1 Failed to load resource: the server responded with a status of 404 (Not Found)
require.js:140 Uncaught Error: Script error for "plotly"
http://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js:165)
    at HTMLScriptElement.onScriptError (require.js:1732)
main.min.js:12406 Loading extension: jupyter-js-widgets/extension
main.min.js:23577 Kernel: kernel_connected (6fbd3818-f86b-4d80-92dd-34b08ff15ea0)
main.min.js:23577 Kernel: kernel_ready (6fbd3818-f86b-4d80-92dd-34b08ff15ea0)
2Belmont%20HVAC%20Vis.ipynb:1 Uncaught TypeError: Cannot read property 'Plots' of undefined
    at eval (eval at globalEval (main.min.js:4), <anonymous>:1:61)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:32 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
WinstonDodsoncommented, Aug 19, 2019

I had the same problem with plotly not displaying in a notebook in Kaggle.

Due to my use of qgrid, I need to run the notebook, then fresh the browser and then run the notebook again in order for qgrid to properly display the df.

I later added an interactive plotly display to the notebook. When I opened the notebook and ran it the plotly display displayed properly but, as usual, the qgrid didn’t. I then refreshed the notebook and the qgrid displayed properly but the plotly display didn’t. I searched and found this page

https://plot.ly/python/renderers/

I then changed the “fig.show()” line in my code to “fig.show(renderer=“notebook”)”

And this fixed my issue.

From reading the many good examples of troubleshooting above (all of which surpass my abilities) and then the plotly page above I would guess that the problem arises when the plotly API tries to automatically detect the best renderer to use. And so, when this is manually set to ‘notebook’ it solves this issue.

I hope that this helps and look forward to any feedback.

0reactions
nicolaskruchtencommented, Mar 31, 2020

I’ve locked this issue for now: if anyone encounters rendering issues in the future please check out our troubleshooting guide at https://plotly.com/python/troubleshooting/ and if that doesn’t help, please feel free to open a new issue 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

matplotlib notebook showing a blank histogram - Stack Overflow
Solution: If you pressed the button and are getting blank plots, restart Jupyter and don't use the power button again if you need...
Read more >
matplotlib shows blank figures in jupyter when input ... - GitHub
matplotlib shows blank figures in jupyter with %matplotlib notebook when an the python 'input()' function is following in the same cell.
Read more >
Blank plots in jupyter notebook in offline mode
Hello, i'm trying to run PLOTLY in offline mode on a disconnected computer (real offline !) this simple code WORKS well when i...
Read more >
Plotly gives blank visualization | Data Science and ... - Kaggle
I use Plotly a lot for visualization. But sometimes Plotly doesnt show the output visualization. Instead, I get only a blank space where...
Read more >
Intro to Julia course: Plotting: plotlyjs yields blank?
Hi, during the lecture on plotting, Plotting | JuliaAcademy (ca. 3 minutes in), she switches over to the plotlyjs() backend.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found