Gnuplot.jl hangs on first run

I am really beginning to like gnuplot and switching over from R’s ggplot (although I still think ggplot might be more flexible and powerful). Anyways, I have a slight problem in the Julia wrapper Gnuplot.jl. It seems that on a cold start, the first time I run my function, the REPL simply hangs (i.e. the function dosn’t return). I have to interrupt the function (by ctrl-z).

Now if I run the function the second time I get

julia> create_trace_plot("NY")
┌ Error: 
└ @ Gnuplot ~/.julia/packages/Gnuplot/7y0ez/src/Gnuplot.jl:897
ERROR: Gnuplot error: ["invalid command"]

but here’s the funny thing. Any subsequent runs of this function runs without error, the function returns, and a plot is displayed. So I am guessing there is some sort of initialization bug in gnuplot.jl that needs to be fixed, but I am not really sure how to find it.

The code used is:

   @gp "set grid" "set key left"
    @gp :- "unset colorbox"
    @gp :- "set xlabel 'iteration'" "set ylabel 'parameter value'"
    #@gp :- "set size 1600, 1480"
    @gp :- "set multiplot layout 5,1 rowsfirst margins 0.05,0.95,0.1,0.9 spacing 0.05,0.02" #l r b t
    @gp :- 1 xvals est[!, :a1] "with lines title 'title'" :-
    @gp :- 2 xvals est[!, :a1] "with lines notitle" :- 
    @gp :- 3 xvals est[!, :a1] "with lines notitle" :- 
    @gp :- 4 xvals est[!, :a1] "with lines notitle" :-
    @gp :- 5 xvals est[!, :a1] "with lines notitle"