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 problems #1756

Closed
albi3ro opened this issue Sep 21, 2018 · 19 comments
Closed

PlotlyJS problems #1756

albi3ro opened this issue Sep 21, 2018 · 19 comments
Labels

Comments

@albi3ro
Copy link
Contributor

albi3ro commented Sep 21, 2018

Running Julia v0.7 in a Jupyter notebook.

Upon running
using Plots; plotlyjs(); plot(x->x^2)

I get
`UndefVarError: JupyterPlot not defined

Stacktrace:
[1] _show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("text/html")}, ::Plots.Plot{Plots.PlotlyJSBackend}) at /Users/mira/.julia/packages/Plots/ex9On/src/backends/plotlyjs.jl:61
[2] show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("text/html")}, ::Plots.Plot{Plots.PlotlyJSBackend}) at /Users/mira/.julia/packages/Plots/ex9On/src/output.jl:206
[3] #sprint#329(::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")}, ::Plots.Plot{Plots.PlotlyJSBackend}) at ./strings/io.jl:97
[5] display_dict(::Plots.Plot{Plots.PlotlyJSBackend}) at /Users/mira/.julia/packages/Plots/ex9On/src/init.jl:59
[6] #invokelatest#1 at ./essentials.jl:691 [inlined]
[7] invokelatest at ./essentials.jl:690 [inlined]
[8] execute_request(::ZMQ.Socket, ::IJulia.Msg) at /Users/mira/.julia/packages/IJulia/4VL8h/src/execute_request.jl:197
[9] #invokelatest#1 at ./essentials.jl:691 [inlined]
[10] invokelatest at ./essentials.jl:690 [inlined]
[11] eventloop(::ZMQ.Socket) at /Users/mira/.julia/packages/IJulia/4VL8h/src/eventloop.jl:8
[12] (::getfield(IJulia, Symbol("##12#15")))() at ./task.jl:262

upon reruningplot(x->x^2)`

I get
`type SyncPlot has no field view

Stacktrace:
[1] getproperty(::Any, ::Symbol) at ./sysimg.jl:18
[2] _create_backend_figure(::Plots.Plot{Plots.PlotlyJSBackend}) at /Users/mira/.julia/packages/Plots/ex9On/src/backends/plotlyjs.jl:15
[3] #invokelatest#1 at ./essentials.jl:691 [inlined]
[4] invokelatest at ./essentials.jl:690 [inlined]
[5] _plot_setup(::Plots.Plot{Plots.PlotlyJSBackend}, ::Dict{Symbol,Any}, ::Array{Dict{Symbol,Any},1}) at /Users/mira/.julia/packages/Plots/ex9On/src/pipeline.jl:215
[6] _plot!(::Plots.Plot{Plots.PlotlyJSBackend}, ::Dict{Symbol,Any}, ::Tuple{getfield(Main, Symbol("##5#6"))}) at ./logging.jl:313
[7] #plot#136(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function) at /Users/mira/.julia/packages/Plots/ex9On/src/plot.jl:57
[8] plot(::Function) at /Users/mira/.julia/packages/Plots/ex9On/src/plot.jl:51
[9] top-level scope at In[2]:1

`

Please give me my plotting utility back soon ....

@mkborregaard
Copy link
Member

Probably dup of #1728 and #1749 .
Until then, all the other backends should be working fine. What about just trying plotly?

@BoundaryValueProblems
Copy link
Contributor

@mkborregaard , I just installed Julia v1.0 instead of v0.7, with Plots.jl v0.20.2, PlotlyJS.jl v0.11.1. Under Juno/Atom, I have the same problem (the 2nd part of the above posting by @albi3ro) using plotlyjs backend: it generates: ERROR: type SyncPlot has no field view when I run a very simple plot command such as plot(randn(100)). On the other hand, if I use the genuine PlotlyJS command without using Plots, it works under Juno/Atom (but does not work under REPL on Terminal). So, something is still not right. On the other hand, both pyplot and gr backends work for me at this moment.

@BoundaryValueProblems
Copy link
Contributor

I want to report the current status with Plots.jl v0.20.3, PlotlyJS.jl v0.11.1, with Atom v1.31.1.

  • plotlyjs backend of Plots.jl still does not display on the plot pane of Atom/Juno, and the error message is the same as before.
  • If we do not use Plots.jl, but use directly PlotlyJS.jl functions, then it does not display things on the plot pane of Atom/Juno unlike the previous situation. On the other hand, if I run PlotlyJS commands in REPL/Terminal, then it works, i.e., it pops up a separate display window and draw things as I expected. So, the situation is flipped compared to a week ago.
  • plotly backend under Plots.jl works, although it displays things on a web browser, rather than on the plot pane of Atom/Juno, as we all know.

Hence, at this point of time, we can use plotly background if we want to use some specific functionality of plotlyjs such as interactively rotating 3D figures. I truly hope that plotlyjs backend will work correctly very soon!

@BoundaryValueProblems
Copy link
Contributor

@daschw and @sglyon , I just wanted to update what I found out with Plots.jl v0.20.6 and PlotlyJS v0.11.2. I could finally plot things under plotlyjs backend of Plots.jl on the plot pane of Atom/Juno! I didn't get any errors after plotting multiple times unlike before. However, it is not yet perfect. Somehow, all those user interaction menus on the top of the figures are not shown there. If I use plotly backend, these menu items are displayed (on my web brouser). Do I need to do anything extra to activate those interactive menu items? I already performed using Blink; Blink.AtomShell.install() earlier. The situation is the same on both Mac and Windows machines.

On the other hand, as @daschw indicated, when I ran things from REPL on a terminal, then the plotting window showed up and the interactive menu items were there, but the plots themselves were incorrect (in fact, no plots but the coordinate grids only) on my Mac. However, somehow, when I ran things on my Windows machine from REPL on a terminal, it worked properly.

@sglyon
Copy link
Member

sglyon commented Oct 20, 2018

@BoundaryValueProblems thank you for the updates here and for patiently helping us along.

Is what was described in the previous message the current status quo with the latest versions of Plots and PlotlyJS?

@BoundaryValueProblems
Copy link
Contributor

@sglyon : yes, it is the current status quo with the latest versions of Plots.jl v0.20.6 and PlotlyJS.jl v0.11.2. Atom/Juno is also up-to-date: Atom v1.31.2; Juno/julia-client v0.7.8.
Should I try the master branch of PlotlyJS? Currently, the master branch of Plots.jl is the same as the tagged version v0.20.6.

@daschw
Copy link
Member

daschw commented Nov 1, 2018

As @mkborregaard suggested this is a duplicate of #1728 and #1749. I'll leave this open for now, though, so we don't loose the valuable reports from @BoundaryValueProblems .

@daschw daschw added the PlotlyJS label Nov 1, 2018
@BoundaryValueProblems
Copy link
Contributor

@daschw & @sglyon ; it's been a while for the plotlyjs backend to be in this status even though several packages have been updated since I posted last time (e.g., Plots v0.21.0; PlotlyJS 0.12.0; WebIO 0.6.0; Atom 1.32.2; atom-julia-client 0.7.10) : It still doesn't work if you run it from Atom/Juno (it plots, but no interactive menu is shown at the top).
Now, I noticed at least one change: if I run it from Terminal, the blank graphics window pops up, but there is no actual plot in that window unlike before. So, in order to see my plots, I have to run things under Atom/Juno. I don't know what happens under IJulia since I really haven't used it yet.

@BoundaryValueProblems
Copy link
Contributor

@daschw & @sglyon, any updates on this long standing issue of plotlyjs backend using Juno/Atom? Now, I upgraded everything up to the very latest ones (Plots: v0.22.0; PlotlyJS: v0.12.1; WebIO: v0.6.1; Atom: 1.33.0; atom-julia-client: v0.7.11) including MacOS Mojave 10.14.2, it still doesn't work. The difference from my previous report is the following: when I run it from the terminal, not via Juno/Atom, then it opens a graphics window, and plots the graphics correctly. Yet, I cannot smoothly rotate the plots using the interactive menu on the top of the graphics window. On the other hand, the plotly backend works very well without any problem.

@BoundaryValueProblems
Copy link
Contributor

@daschw & @sglyon: I just want to update the current status: Plots: v0.23.0; PlotlyJS: v0.12.3; WebIO: v0.7.0; Atom: v1.34.0; atom-julia-client v0.7.13. Now, if I run julia from a terminal, then things get better than before, i.e., it opens a graphics window and I can interact with the graphics object in a much smoother way than before, e.g., rotations, zooming, etc. However, under Atom/Juno, the interaction menu does not show at the top of the figure, and I cannot interact with the graphics object. What would be the standing block of preventing this interactivity under Atom/Juno?

@mkborregaard
Copy link
Member

also cc @pfitzseb

@pfitzseb
Copy link
Contributor

The problem here is that Juno doesn't support WebIO 0.7 (which is the same as 0.4.2) right now and I haven't yet had the energy to fix that yet again ;) Things might work again if you pin WebIO to 0.6.2.

@BoundaryValueProblems
Copy link
Contributor

@pfitzseb ; I just tried WebIO 0.6.2 by pinning it. But it still didn't show the interactive menu :-(

@BoundaryValueProblems
Copy link
Contributor

@daschw, @sglyon, and @mkborregaard : I just want to update a bit. I understand that the plotlyjs backend does not work under Juno/Atom at this point. Now, today, I tested the plotlyjs backend under IJulia v1.17.0/Jupyter. It does not work either. No plotting. But it didn't throw any errors.

daschw added a commit that referenced this issue Aug 8, 2019
@daschw
Copy link
Member

daschw commented Aug 8, 2019

Hopefully closed in #2131

@daschw daschw closed this as completed Aug 8, 2019
@BoundaryValueProblems
Copy link
Contributor

@daschw ; Thanks for your effort. However, it works neither on my MacBook Pro nor on my Windows 10 machine. It displays the figure in the Atom/Juno plot pane, but the interaction panel on the top still does not show up. I use the latest versions of the julia system + Atom/Juno, i.e., Julia: v1.1.1, Atom: v1.39.1, ink: v0.10.12, julia-client: v0.9.4.
The versions of various appropriate julia packages I installed are:

  [c52e3926] Atom v0.9.1
  [ad839575] Blink v0.12.0 #master (https://github.com/JunoLab/Blink.jl.git)
  [e5e0dc1b] Juno v0.7.1
  [47be7bcc] ORCA v0.2.1
  [5fb14364] OhMyREPL v0.5.1
  [f0f68f2c] PlotlyJS v0.12.5 #master (https://github.com/sglyon/PlotlyJS.jl.git)
  [91a5bcdd] Plots v0.26.1 #master (https://github.com/JuliaPlots/Plots.jl.git)
  [d330b81b] PyPlot v2.8.1
  [0f1e0344] WebIO v0.8.9 #master (https://github.com/JuliaGizmos/WebIO.jl.git)

Also a large number of warnings show up when I ran plotlyjs():

julia> plotlyjs()
[ Info: Recompiling stale cache file /Users/xxx/.julia/compiled/v1.1/PlotlyJS/1r9Ld.ji for PlotlyJS [f0f68f2c-4968-5e81-91da-67840de0976a]
┌ Warning: Module JSON with build ID 339475145142170 is missing from the cache.
│ This may mean JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:947
┌ Warning: Module JSON with build ID 339475145142170 is missing from the cache.
│ This may mean JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:947
[ Info: Precompiling PlotlyBase [a03496cd-edff-5a9b-9e67-9cda94a718b5]
┌ Warning: Module JSON with build ID 339475145142170 is missing from the cache.
│ This may mean JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:947
[ Info: Recompiling stale cache file /Users/xxx/.julia/compiled/v1.1/WebIO/v9IED.ji for WebIO [0f1e0344-ec1d-5b48-a673-e5cf874b6c29]
┌ Warning: Module JSON with build ID 339475145142170 is missing from the cache.
│ This may mean JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:947
┌ Warning: Module JSON with build ID 339475145142170 is missing from the cache.
│ This may mean JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:947
[ Info: Precompiling AssetRegistry [bf4720bc-e11a-5d0c-854e-bdca1663c893]
┌ Warning: Module JSON with build ID 339475145142170 is missing from the cache.
│ This may mean JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:947
┌ Warning: Error requiring WebIO from Atom:
│ could not open file /Users/xxx/.julia/packages/Atom/BXRAC/src/display/webio.jl
│ Stacktrace:
│  [1] include at ./boot.jl:326 [inlined]
│  [2] include_relative(::Module, ::String) at ./loading.jl:1038
│  [3] include at ./sysimg.jl:29 [inlined]
│  [4] include(::String) at /Users/xxx/.julia/packages/Atom/BXRAC/src/Atom.jl:3
│  [5] top-level scope at /Users/xxx/.julia/packages/Atom/BXRAC/src/Atom.jl:36
│  [6] eval at ./boot.jl:328 [inlined]
│  [7] eval at /Users/xxx/.julia/packages/Atom/BXRAC/src/Atom.jl:3 [inlined]
│  [8] (::getfield(Atom, Symbol("##5#10")))() at /Users/xxx/.julia/packages/Requires/9Jse8/src/require.jl:67
│  [9] err(::getfield(Atom, Symbol("##5#10")), ::Module, ::String) at /Users/xxx/.julia/packages/Requires/9Jse8/src/require.jl:38
│  [10] #4 at /Users/xxx/.julia/packages/Requires/9Jse8/src/require.jl:66 [inlined]
│  [11] withpath(::getfield(Atom, Symbol("##4#9")), ::String) at /Users/xxx/.julia/packages/Requires/9Jse8/src/require.jl:28
│  [12] (::getfield(Atom, Symbol("##3#8")))() at /Users/xxx/.julia/packages/Requires/9Jse8/src/require.jl:65
│  [13] #invokelatest#1 at ./essentials.jl:742 [inlined]
│  [14] invokelatest at ./essentials.jl:741 [inlined]
│  [15] #3 at /Users/xxx/.julia/packages/Requires/9Jse8/src/require.jl:19 [inlined]
│  [16] iterate at ./generator.jl:47 [inlined]
│  [17] _collect(::Array{Function,1}, ::Base.Generator{Array{Function,1},getfield(Requires, Symbol("##3#4"))}, ::Base.EltypeUnknown, ::Base.HasShape{1}) at ./array.jl:619
│  [18] map at ./array.jl:548 [inlined]
│  [19] loadpkg(::Base.PkgId) at /Users/xxx/.julia/packages/Requires/9Jse8/src/require.jl:19
│  [20] #invokelatest#1 at ./essentials.jl:742 [inlined]
│  [21] invokelatest at ./essentials.jl:741 [inlined]
│  [22] require(::Base.PkgId) at ./loading.jl:861
│  [23] require(::Module, ::Symbol) at ./loading.jl:853
│  [24] include at ./boot.jl:326 [inlined]
│  [25] include_relative(::Module, ::String) at ./loading.jl:1038
│  [26] _require(::Base.PkgId) at ./loading.jl:986
│  [27] require(::Base.PkgId) at ./loading.jl:858
│  [28] require(::Module, ::Symbol) at ./loading.jl:853
│  [29] top-level scope at /Users/xxx/.julia/packages/Plots/Khh8V/src/backends.jl:465
│  [30] eval at ./boot.jl:328 [inlined]
│  [31] _initialize_backend(::Plots.PlotlyJSBackend) at /Users/xxx/.julia/packages/Plots/Khh8V/src/backends.jl:464
│  [32] backend(::Plots.PlotlyJSBackend) at /Users/xxx/.julia/packages/Plots/Khh8V/src/backends.jl:177
│  [33] #plotlyjs#262 at /Users/xxx/.julia/packages/Plots/Khh8V/src/backends.jl:33 [inlined]
│  [34] plotlyjs() at /Users/xxx/.julia/packages/Plots/Khh8V/src/backends.jl:33
│  [35] top-level scope at none:0
│  [36] eval at ./boot.jl:328 [inlined]
│  [37] repleval(::Module, ::Expr) at /Users/xxx/.julia/packages/Atom/BXRAC/src/repl.jl:135
│  [38] (::getfield(Atom, Symbol("##168#170")){Module})() at /Users/xxx/.julia/packages/Atom/BXRAC/src/repl.jl:157
│  [39] with_logstate(::getfield(Atom, Symbol("##168#170")){Module}, ::Base.CoreLogging.LogState) at ./logging.jl:395
│  [40] with_logger at ./logging.jl:491 [inlined]
│  [41] evalrepl(::Module, ::String) at /Users/xxx/.julia/packages/Atom/BXRAC/src/repl.jl:148
│  [42] top-level scope at /Users/xxx/.julia/packages/Atom/BXRAC/src/repl.jl:190
│  [43] eval(::Module, ::Any) at ./boot.jl:328
│  [44] eval_user_input(::Any, ::REPL.REPLBackend) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:85
│  [45] macro expansion at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:117 [inlined]
│  [46] (::getfield(REPL, Symbol("##26#27")){REPL.REPLBackend})() at ./task.jl:259
└ @ Requires ~/.julia/packages/Requires/9Jse8/src/require.jl:40
[ Info: Recompiling stale cache file /Users/xxx/.julia/compiled/v1.1/JSExpr/uKlm7.ji for JSExpr [97c1335a-c9c5-57fe-bc5d-ec35cebe8660]
┌ Warning: Module JSON with build ID 339475145142170 is missing from the cache.
│ This may mean JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:947
[ Info: Recompiling stale cache file /Users/xxx/.julia/compiled/v1.1/Blink/wSmkt.ji for Blink [ad839575-38b3-5650-b840-f874b8c74a25]
┌ Warning: Module JSExpr with build ID 612816374974659 is missing from the cache.
│ This may mean JSExpr [97c1335a-c9c5-57fe-bc5d-ec35cebe8660] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:947
[ Info: Recompiling stale cache file /Users/xxx/.julia/compiled/v1.1/Mux/cs9xb.ji for Mux [a975b10e-0019-58db-a62f-e48ff68538c9]
┌ Warning: Module Hiccup with build ID 11924564602526 is missing from the cache.
│ This may mean Hiccup [9fb69e20-1954-56bb-a84f-559cc56a8ff7] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:947
[ Info: Recompiling stale cache file /Users/xxx/.julia/compiled/v1.1/Mustache/iK5hJ.ji for Mustache [ffc61752-8dc7-55ee-8c37-f3e9cdd09e70]
[ Info: Recompiling stale cache file /Users/xxx/.julia/compiled/v1.1/ORCA/jvX7k.ji for ORCA [47be7bcc-f1a6-5447-8b36-7eeeff7534fd]
┌ Warning: Module PlotlyBase with build ID 612808180193713 is missing from the cache.
│ This may mean PlotlyBase [a03496cd-edff-5a9b-9e67-9cda94a718b5] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:947
Plots.PlotlyJSBackend()

Thanks a lot for your further help! If my setting is not unusual, please re-open this issue.

@BoundaryValueProblems
Copy link
Contributor

@daschw, I just rebuilt the packages via (v1.1) pkg> build. Then, when I ran plotlyjs(), the warning messages I reported earlier were all gone. Yet, the panel of interaction at the top of the figure still does not show either in macOS or Windows 10. Under what configuration, could you get the working interaction panel on your system?

@BoundaryValueProblems
Copy link
Contributor

BoundaryValueProblems commented Aug 9, 2019

@daschw ; OK, the problem seems plotlyjs backend of Plots. If I do using PlotlyJS, and use PlotlyJS functions directly instead of using Plots functions, then it works (i.e., the interaction panel nicely appears on Juno's plot pane!). But unfortunately, it doesn't work properly under Plots yet.

@daschw
Copy link
Member

daschw commented Aug 9, 2019

You're right, I have not found a workaround for that. So in Juno with Plots and plotlyjs() only a non-interactive PNG is displayed. I closed this issue, because the originally reported problem, which was not related interactivity in Juno, is now fixed. Feel free to open a new issue specifically for Juno/PlotlyJS/Interactivity issues to keep track of that.

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

No branches or pull requests

6 participants