PlotlyJS.jl icon indicating copy to clipboard operation
PlotlyJS.jl copied to clipboard

JupyterPlot not defined

Open dpsanders opened this issue 6 years ago • 9 comments

I’m trying to use the PlotlyJS backend on Julia 1.0 on Mac, but am getting

UndefVarError: JupyterPlot not defined

Stacktrace:
 [1] _show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("text/html")}, ::Plots.Plot{Plots.PlotlyJSBackend}) at /Users/dpsanders/.julia/packages/Plots/EJpx2/src/backends/plotlyjs.jl:61
 [2] show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("text/html")}, ::Plots.Plot{Plots.PlotlyJSBackend}) at /Users/dpsanders/.julia/packages/Plots/EJpx2/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 /Users/dpsanders/.julia/packages/Plots/EJpx2/src/init.jl:76
 [6] #invokelatest#1 at ./essentials.jl:686 [inlined]
 [7] invokelatest at ./essentials.jl:685 [inlined]
 [8] execute_request(::ZMQ.Socket, ::IJulia.Msg) at /Users/dpsanders/.julia/packages/IJulia/k5o7j/src/execute_request.jl:197
 [9] #invokelatest#1 at ./essentials.jl:686 [inlined]
 [10] invokelatest at ./essentials.jl:685 [inlined]
 [11] eventloop(::ZMQ.Socket) at /Users/dpsanders/.julia/packages/IJulia/k5o7j/src/eventloop.jl:8
 [12] (::getfield(IJulia, Symbol("##12#15")))() at ./task.jl:259

dpsanders avatar Sep 10 '18 06:09 dpsanders

The plotlyjs backend for Plots.jl is close to ready, but not quite there.

See here for status: https://github.com/JuliaPlots/Plots.jl/pull/1730

In the mean time you can try using just PlotlyJS by itself, or see if another plots backend works for you.

Hopefully everything is running smoothly in the next couple of days

sglyon avatar Sep 10 '18 12:09 sglyon

OK, thanks a lot - sorry, I didn't realise that the backend was not released at the same time.

dpsanders avatar Sep 10 '18 14:09 dpsanders

Any update on this?

dpsanders avatar Oct 19 '18 04:10 dpsanders

No, not yet sorry. I don't anticipate it being difficult, but I don't think Plots maintainers or myself have had the time to dig into it

sglyon avatar Oct 19 '18 13:10 sglyon

Coming from above reference: Julia/Plots.jl#1793 with renewed request for fix.

fpmenninger avatar Dec 05 '18 20:12 fpmenninger

Should not be happening on recent versions of Plots or PlotlyJS

sglyon avatar Dec 10 '18 18:12 sglyon

I still see this with master from both PlotlyJS and Plots. I tried to figure out what happened by going through the history. It seems at during the rework on 27 and 28 Aug, the PlotlyJS/src/displays/ijulia.jl was deleted and the code reworked. But the Plots/backends/plotlyjs.jl file was not updated to work with the new structure. Unfortunately it is such a big rework, that it isn't obvious to me what the new equivalent to JupyterPlot is in the new code architecture. Thus no quick PR, it will take a bit of time to study what is going on.

lwabeke avatar Dec 14 '18 13:12 lwabeke

@lwabeke could you please provide a link to the file and line in Plots.jl that still uses JupyterPlot?

sglyon avatar Dec 14 '18 13:12 sglyon

https://github.com/JuliaPlots/Plots.jl/blob/712b567752989ad3ba9319620a93923577a4259b/src/backends/plotlyjs.jl#L55
write(io, PlotlyJS.html_body(PlotlyJS.JupyterPlot(plt.o)))

lwabeke avatar Dec 14 '18 13:12 lwabeke