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

UndefVarError using PlotlyJS backend #1793

Closed
paulduf opened this issue Oct 16, 2018 · 9 comments
Closed

UndefVarError using PlotlyJS backend #1793

paulduf opened this issue Oct 16, 2018 · 9 comments

Comments

@paulduf
Copy link

paulduf commented Oct 16, 2018

Hello

I'm new to Julia and I'm trying to plot offline using PlotlyJS module.

Basic plot gives me this error. Surely I'm missing some important setup part but I can't debug this (at least not without spending many hours)

UndefVarError: _use_remote not defined

Stacktrace:
 [1] _show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("text/html")}, ::Plots.Plot{Plots.PlotlyJSBackend}) at /home/pol/.julia/packages/Plots/Ufx0i/src/backends/plotlyjs.jl:54
 [2] show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("text/html")}, ::Plots.Plot{Plots.PlotlyJSBackend}) at /home/pol/.julia/packages/Plots/Ufx0i/src/output.jl:201
 [3] #sprint#325(::Nothing, ::Int64, ::Function, ::Function, ::MIME{Symbol("text/html")}, ::Vararg{Any,N} where N) at ./strings/io.jl:101
 [4] sprint(::Function, ::MIME{Symbol("text/html")}, ::Vararg{Any,N} where N) at ./strings/io.jl:97
 [5] display_dict(::Plots.Plot{Plots.PlotlyJSBackend}) at /home/pol/.julia/packages/Plots/Ufx0i/src/init.jl:76
 [6] #invokelatest#1 at ./essentials.jl:697 [inlined]
 [7] invokelatest at ./essentials.jl:696 [inlined]
 [8] execute_request(::ZMQ.Socket, ::IJulia.Msg) at /home/pol/.julia/packages/IJulia/0cLgR/src/execute_request.jl:256
 [9] #invokelatest#1 at ./essentials.jl:697 [inlined]
 [10] invokelatest at ./essentials.jl:696 [inlined]
 [11] eventloop(::ZMQ.Socket) at /home/pol/.julia/packages/IJulia/0cLgR/src/eventloop.jl:8
 [12] (::getfield(IJulia, Symbol("##12#15")))() at ./task.jl:259
@mkborregaard
Copy link
Member

Could you post the code to reproduce the error? What packages are you using etc.

@pnavaro
Copy link

pnavaro commented Oct 23, 2018

using Plots
plotlyjs()
plot(Plots.fakedata(50,5),w=3)

The problem appears only with IJulia and Jupyter

@ederag
Copy link

ederag commented Oct 25, 2018

Trying to comment out in this line

if isijulia() && !_use_remote[]

the offending _use_remote:

    if isijulia() # && !_use_remote[]
        write(io, PlotlyJS.html_body(PlotlyJS.JupyterPlot(plt.o)))

yields

UndefVarError: JupyterPlot not defined

This one is known:
JuliaPlots/PlotlyJS.jl#221

@fpmenninger
Copy link

fpmenninger commented Dec 5, 2018

Same behavior here.
Using Windows 7, Julia 1.0.2.
using code of @pnavaro above, receive same error of:

UndefVarError: _use_remote not defined

And if comment out in line 54 as @ederag above, receive same error of

UndefVarError: JupyterPlot not defined 

and reinforcing reference:
JuliaPlots/PlotlyJS.jl#221

@juliohm
Copy link

juliohm commented Dec 18, 2018

Is there any solution to this issue? I am having the same _use_remote not defined error message. Basically can't use PlotlyJS in Jupyter.

@SimonDanisch
Copy link
Member

I think you can do a match + replace a la:
_use_remote -> !use_local_dependencies

@juliohm
Copy link

juliohm commented Dec 18, 2018

@SimonDanisch I found this line:

    if isijulia() && !_use_remote[]

and replaced it with:

    if isijulia() && use_local_dependencies[]

Now I don't get an error, but no plot is shown. I have also replaced the other occurrences but I think they are unrelated.

@alecloudenback
Copy link

@SimonDanisch I found this line:

    if isijulia() && !_use_remote[]

and replaced it with:

    if isijulia() && use_local_dependencies[]

Now I don't get an error, but no plot is shown. I have also replaced the other occurrences but I think they are unrelated.

This fixed it for me. For those trying to do the same, the reference code is actually in the Plots.jl repo in backends/plotlyjs.jl.

@mkborregaard
Copy link
Member

Closed in #1885

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

No branches or pull requests

9 participants