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.

go.Figure() does not render in JupyterLab, only go.FigureWidget()

See original GitHub issue

go.Figure() does not render in JupyterLab, only go.FigureWidget().

Chrome Console Error: Uncaught ReferenceError: require is not defined

Example:

import plotly
import plotly.io as pio
import plotly.graph_objects as go

figwidget = go.FigureWidget(data=go.Bar(y=[1, 2, 3]))
fig = go.Figure(data=go.Bar(y=[3, 2, 1]))

display(pio.renderers)
display(figwidget)
display(fig)
image

Jupyter & Plotly specifics:

%load_ext watermark
%watermark -d -iv -v -m -u -n -t -z
!jupyter labextension list plotly
plotly 4.4.1
last updated: 2020-01-12 22:40:00 EST 

CPython 3.7.6
IPython 7.11.1

compiler   : Clang 4.0.1 (tags/RELEASE_401/final)
system     : Darwin
release    : 19.2.0
machine    : x86_64
processor  : i386
CPU cores  : 4
interpreter: 64bit
JupyterLab v1.2.4
Known labextensions:
   app dir: ~/anaconda3/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v1.1.0  enabled  OK
        jupyterlab-plotly v1.4.0  enabled  OK
        plotlywidget v1.4.0  enabled  OK
        qgrid v1.1.1  enabled  OK

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
HaithamMayacommented, Nov 18, 2020

@surchs thank you I should have thought of that!

So the python kernel that I run the jupyter server on is different than the python kernels I use in jupyter. I was assuming the install needed to be on the kernels being used in the notebook, not on the jupyter server’s kernel itself. That has resolved my issue.

image
1reaction
surchscommented, Nov 17, 2020

@ahotrod @HaithamMaya: any chance you are running jupyter with more than one python kernel (i.e. https://ipython.readthedocs.io/en/stable/install/kernel_install.html)? If so, please ensure that the jupyterlab-plotly extension is available in the python environment you use to start jupyterlab.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FigureWidget doesn't print graph - Plotly Community Forum
The following code doesn't output anything: import plotly.graph_objects as go f = go.FigureWidget() f. while this code 'w/ the .show()' ...
Read more >
Plotly chart not showing in Jupyter notebook - Stack Overflow
There are two extensions: jupyterlab-plotly for rendering figures with fig.show() and plotlywidget for the FigureWidget .
Read more >
Getting Started with Plotly-Python | by hemanshi - Medium
import plotly.graph_objects as go fig = go.Figure(data=go.Bar(y=[2, 3, 1])) fig.show(). or using FigureWidget objects.
Read more >
Plotly i - Tutorialspoint
Finally, there is a Figure object created by go.Figure() function. It is a dictionary-like object that contains both the data object and the...
Read more >
Unable to display plotly figures output - JupyterLab
When rendering plotly figures, I get an empty white frame. Example code: import plotly.express as px df = px.data.iris() fig = px.scatter(df ...
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