Julia Plots.jl with plotlyJS backend pauses on every call to savefig

plotting

#1

Hi all,

I’m getting the following issue when attempting to use savefig() with the Plots.jl package and plotlyjs() backend (note, Julia v0.5.0, Plots.jl v0.10.3, PlotlyJS.jl v0.5.2, Blink v0.5.1, on Ubuntu 16.04) . Oddly enough, I am able to successfully save a plot to .png, but the REPL pauses during the save operation with the below text. If I hit enter, I get back to a new line in the REPL and the plot has saved. So from a user perspective, the only issue is that I can’t set something to run and save plots while I move away from the keyboard, since I’ll need to hit enter every time a new plot is saved. So, I open Julia at the REPL and run the following commands:

julia> using Plots

julia> plotlyjs()
Plots.PlotlyJSBackend()

julia> p = plot(randn(10));

julia> savefig(p, “/home/colin/Temp/myplot.png”)

The following text is displayed the first time I run savefig (as above):

WARNING: bytestring(s::AbstractString…) is deprecated, use string(s…) instead.
WARNING: the no-op transpose fallback is deprecated, and no more specific transpose method for ArgumentError exists. Consider permutedims(x, [2, 1]) or writing a specific transpose(x::ArgumentError) method if appropriate. in
depwarn in (depwarn::(String, ::String, ::Symbol)::Symbol) at ./deprecated.jl:64
at in ./deprecated.jlbytestring:(64
:: in Stringtranspose)( at ./deprecated.jl:50
:: in ArgumentErrorhandle_new_from_data)( at ./deprecated.jl:770
:: in Stringws_handler, (::Gtk.GLib.GError)::Dict{Any,Any}) at /home/colin/.julia/v0.5/Rsvg/src/calls.jl:61
at in /home/colin/.julia/v0.5/Blink/src/content/server.jlhandle_new_from_data:(45
:: in Stringsplitquery)( at /home/colin/.julia/v0.5/Rsvg/src/calls.jl:69
:: in Blink#savefig#175.(#ws_handler, ::Symbol, ::Dict{Any,Any})::Function, at /home/colin/.julia/v0.5/Mux/src/basics.jl:28
:: in PlotlyJSwcatch.(SyncPlot{PlotlyJS.ElectronDisplay}, ::Mux.##1#2{Mux.#splitquery,Blink.#ws_handler}, ::String)::Dict{Any,Any}) at /home/colin/.julia/v0.5/PlotlyJS/src/savefig.jl:164
at in /home/colin/.julia/v0.5/Mux/src/websockets_integration.jlsavefig:(12
:: in PlotlyJS.SyncPlot{PlotlyJS.ElectronDisplay}, (::Mux.##1#2{Mux.##3#4{Mux.##3#4{Mux.#todict,Mux.#wcatch},Mux.#splitquery},Blink.#ws_handler})(::String)::Tuple{HttpCommon.Request,WebSockets.WebSocket}) at /home/colin/.julia/v0.5/PlotlyJS/src/savefig.jl:106
at in /home/colin/.julia/v0.5/Mux/src/Mux.jlplotlyjs_save_hack:10
at in /home/colin/.julia/v0.5/Plots/src/backends/plotlyjs.jl:98 [inlined](::
Mux in ._show##13#14{Mux.App})( at /home/colin/.julia/v0.5/Plots/src/backends/plotlyjs.jl:101 [inlined]::
HttpCommon in .showRequest(, ::IOStream, ::WebSockets.WebSocket)::MIME{Symbol(“image/png”)}, at /home/colin/.julia/v0.5/Mux/src/server.jl:38
:: in Plotshandle.(Plot{Plots.PlotlyJSBackend})::WebSockets.WebSocketHandler, at /home/colin/.julia/v0.5/Plots/src/output.jl:197
:: in HttpCommonpng.(Request, ::Plots.Plot{Plots.PlotlyJSBackend}, ::HttpServer.Client{TCPSocket})::String) at /home/colin/.julia/v0.5/WebSockets/src/WebSockets.jl:382
at in /home/colin/.julia/v0.5/Plots/src/output.jl:8
(:: in HttpServersavefig.(#on_message_complete#18{HttpServer.Server,HttpServer.Client{TCPSocket},Bool})(::Plots.Plot{Plots.PlotlyJSBackend}, ::HttpCommon.Request)::String) at /home/colin/.julia/v0.5/HttpServer/src/HttpServer.jl:420
at in /home/colin/.julia/v0.5/Plots/src/output.jlon_message_complete:(116
:: in Ptreval{(HttpParser.Parser})::Module, at /home/colin/.julia/v0.5/HttpServer/src/RequestParser.jl:113
:: in Anyhttp_parser_execute)( at ./boot.jl:234
:: in HttpParsereval_user_input.(Parser, ::Any, ::HttpParser.ParserSettings, ::Base.REPL.REPLBackend)::Array{UInt8,1}) at ./REPL.jl:64
at in /home/colin/.julia/v0.5/HttpParser/src/HttpParser.jlmacro expansion:115
at in ./REPL.jlprocess_client:(95 [inlined]::
HttpServer in .Server, (::Base.REPL.##3#4{Base.REPL.REPLBackend})(::)HttpServer.Client{TCPSocket}, at ./event.jl:68
while loading no file, in expression starting on line 0::
Bool)
julia> 389
in (::HttpServer.##8#10{HttpServer.Server,Bool})() at ./task.jl:360
while loading no file, in expression starting on line 0
Error handling websocket connection:
MethodError: no method matching *(::ArgumentError, ::Blink.#msg)
Closest candidates are:
*(::Any, ::Any, ::Any, ::Any…) at operators.jl:138

Any subsequent calls to savefig will pause, but with the (greatly reduced) following text:

julia> no method matching *(::ArgumentError, ::Blink.#msg)
Closest candidates are:
*(::Any, ::Any, ::Any, ::Any…) at operators.jl:138

and, as with the first call, I can just hit enter and then get returned to a new line in the console and the plot has successfully saved.

Does anyone have any ideas about how I can resolve this? Even information on whether this a problem specific to my installation, or something affecting multiple users would be helpful.

Thanks in advance.

Colin


#2

It looks like the warning is from Rsvg - what is your version of that? (I have 0.0.2)


#3

You are right, there is a deprecation warning from Rsvgs usage of bytestring which shows up in 0.5, and this should be solved by proper Compat inclusion in Rsvg (which is needed anyway for 0.6).

But still, why does a deprecation warning slow down the call?


#4

Thanks for responding. I’m on Rsvg 0.0.2 also.


#5

Thanks for responding. Is the implication that this problem will likely be fixed in v0.6? If so, I guess it is probably most optimal to just wait it out rather than wasting time troubleshooting, since my understanding is the stable v0.6 is fairly close…