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 plot in Jupyter Lab

See original GitHub issue

This gives blank output in Jupyter Lab running this simple example:

import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(y=[2, 1, 4, 3]))
fig.add_trace(go.Bar(y=[1, 4, 3, 2]))
fig.update_layout(title = 'Hello Figure')
fig.show()

I am running node v12.17.0 and python 3.8.2. and conda 4.8.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

51reactions
mathworldcommented, Aug 27, 2021

If it helps someone, but I’ve always used

import plotly.io as pio pio.renderers.default = "iframe"

when plotly plots don’t show up in jupyter notebook/lab.

3reactions
ismailuddincommented, Jun 12, 2020

I’m still having this exact same problem on Windows with JupyterLab. Plotly Python package version is ‘4.8.1’, and so are the lab extensions (as installed with the version set to 4.8.1 as per the documentation). But if I launch a classic notebook, the same notebook file shows the plots. If I look at the console when inside a JupyterLab template, I get the error

Uncaught ReferenceError: require is not defined
....

                require(["plotly"], function(Plotly) {
                    window.PLOTLYENV=window.PLOTLYENV || {};
                    
                if (document.getElementById("8c520407-3036-4b5f-9834-304ee04c0f38")) {

But Plotly with JupyterLab on Mac doesn’t give me this problem…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plotly gives an empty field as output in jupyter lab
To properly display the plotly offline graphs in JupyterLab,. Step 1: We need to first install the plotly-extension for JupyterLab:
Read more >
Blank figure in jupyterlab - Plotly Community Forum
I tried to run a simple plotly example code in a jupyterlab and I keep getting a blank object. import plotly.graph_objects as go...
Read more >
fix blank plot when using plotly in jupyter lab - Chadrick's Blog
while using vscode, I noticed that pylance wasn't running even after forcing pylance server restart. I checked the output logs and it was...
Read more >
Unable to display plotly figures output - JupyterLab
I am working on Jupyterlab on a docker container, on an EC2 machine on AWS, ... When rendering plotly figures, I get an...
Read more >
Display Troubleshooting — Altair 4.2.0 documentation
A similar blank chart results if you refer to a field that does not exist in ... If you are using JupyterLab (not...
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