I am trying to update an existing plot with a second trace using PlotlyJS with Julia 1.0 and Atom on Windows 8.1.
using Plots
using PlotlyJS
plotlyjs() # intended to switch to the according backend
x = [range(0, length = 100, stop = 2pi);]
y = sin.(x)
y2 = cos.(x)
If I next use plot(x, y)
I get the error message that both Plots and PlotlyJS export this function and I need to specify the backend. It thought this was done by the plotlyjs()
command, but obviously not.
PlotlyJS.plot(x, y)
displays the plot just fine in Atom’s plotting pane, with all the interactivity.
However, I cannot figure out how to add the y2-data to the plot.
plot!(x, y2)
either uses the GR-backend or throws an error message within the Atom-GUI (not the REPL) (using the GR backend only seems to happen, if I had used it before, while the following error is thrown after freshly starting Atom):
Julia Client – Internal Error
Please call `using ORCA` to save figures
try_yieldto(::typeof(Base.ensure_rescheduled), ::Base.RefValue{Task}) at event.jl:196
wait() at event.jl:255
wait(::Condition) at event.jl:46
wait(::Task) at task.jl:188
fetch at task.jl:202 [inlined]
macro expansion at dynamic.jl:67 [inlined]
(::getfield(Atom, Symbol("##113#119")))(::Dict{String,Any}) at eval.jl:86
handlemsg(::Dict{String,Any}, ::Dict{String,Any}) at comm.jl:164
(::getfield(Atom, Symbol("##19#21")){Array{Any,1}})() at task.jl:259
If I use PlotlyJS.plot!(x, y2)
I get the error that plot! is not defined.
If I only rely on the Plots
-Package (i.e. GR backend) then
plot(x, y)
plot!(x, y2)
works just fine.
I am not sure, whether this is a problem of
- my code
- the PlotlyJS package or
- the PlotlyJS/Plots integration.
Can somebody reproduce this problem and/or correct my code?
Thanks ahead.