Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlotlyJS shows an emptycell in jupyterlab with no error #339

Open
Masacroso opened this issue Aug 5, 2019 · 2 comments · Fixed by JuliaPlots/PlotlyJS.jl#288
Open

PlotlyJS shows an emptycell in jupyterlab with no error #339

Masacroso opened this issue Aug 5, 2019 · 2 comments · Fixed by JuliaPlots/PlotlyJS.jl#288
Labels

Comments

@Masacroso
Copy link

Masacroso commented Aug 5, 2019

ISSUE

In jupyterlab a plot generated by a chunk of code and the package PlotlyJS is not shown, that is, when executed it appear just an empty cell. The labextension of WebIO is installed and detected.

By example running this chunk of julia in a cell of jupyterlab

using PlotlyJS
trace1 = scatter(;x=1:4, y=[0, 2, 3, 5], fill="tozeroy")
trace2 = scatter(;x=1:4, y=[3, 5, 1, 7], fill="tonexty")
plot([trace1, trace2])

the output cell is empty, with no error message.


CONTEXT

Im not completely sure if the issue (not showing a plot of PlotlyJS package in Jupyter lab) is due to WebIO or not, but I suspect it is the case. This is a direct continuation of this closed thread.

Im running julia and jupyterlab 1.0.2 in windows 10, with these packages installed:

[c52e3926] Atom v0.8.8
  [6e4b80f9] BenchmarkTools v0.4.2
  [ad839575] Blink v0.12.0
  [336ed68f] CSV v0.5.9
  [5ae59095] Colors v0.9.5
  [a93c6f00] DataFrames v0.19.1
  [6e83dbb3] Discretizers v3.0.1
  [31c24e10] Distributions v0.21.1
  [28b8d3ca] GR v0.41.0
  [f67ccb44] HDF5 v0.12.0
  [7073ff75] IJulia v1.19.0
  [c601a237] Interact v0.10.2
  [a98d9a8b] Interpolations v0.12.2
  [033835bb] JLD2 v0.1.2
  [e5e0dc1b] Juno v0.7.0
  [5ab0869b] KernelDensity v0.5.1
  [b964fa9f] LaTeXStrings v1.0.3
  [ee78f7c6] Makie v0.9.4
  [47be7bcc] ORCA v0.2.1
  [3b7a836e] PGFPlots v3.1.3
  [8314cec4] PGFPlotsX v1.1.0
  [f0f68f2c] PlotlyJS v0.12.5
  [91a5bcdd] Plots v0.26.0
  [d330b81b] PyPlot v2.8.1
  [6f49c342] RCall v0.13.3
  [ce6b1742] RDatasets v0.6.3
  [e6cf234a] RandomNumbers v1.3.0
  [2913bbd2] StatsBase v0.32.0
  [0f1e0344] WebIO v0.8.9

SUMMARY

The point is that the labextension of WebIO is installed and detected, however when I try to show a PlotlyJS plot then jupyterlab shows an empty cell, BUT if I do the same in a jupyter notebook it shows correctly the plot, so I suspect that this is due to something related to the package WebIO more like to the package PlotlyJS, so I opened the issue here.

@twavv
Copy link
Member

twavv commented Aug 5, 2019

This is kind of a PlotlyJS issue but it might be something we should fix on this side. Ping @sglyon.

The issue is that PlotlyJS loads JavaScript which assumes the existence of a WebIO window global which is not the case in JupyterLab (because there can be multiple WebIO instances and otherwise there might be "cross-talk" between the multiple instances). The WebIO global does exist inside of onmount and onjs handlers because of the way that WebIO evals the JS code.

I'll put out a PR to PlotlyJS to fix this.

@Masacroso
Copy link
Author

This is kind of a PlotlyJS issue but it might be something we should fix on this side. Ping @sglyon.

The issue is that PlotlyJS loads JavaScript which assumes the existence of a WebIO window global which is not the case in JupyterLab (because there can be multiple WebIO instances and otherwise there might be "cross-talk" between the multiple instances). The WebIO global does exist inside of onmount and onjs handlers because of the way that WebIO evals the JS code.

I'll put out a PR to PlotlyJS to fix this.

Thank you very much for your time an effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants