# Gnuplot.jl hangs on first run

**URL:** https://discourse.julialang.org/t/gnuplot-jl-hangs-on-first-run/47946
**Category:** General Usage
**Created:** [October 7, 2020, 4:29pm UTC](https://discourse.julialang.org/t/gnuplot-jl-hangs-on-first-run/47946 "2020-10-07T16:29:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)
#### Post date: [October 7, 2020, 4:29pm UTC](https://discourse.julialang.org/t/gnuplot-jl-hangs-on-first-run/47946/1 "2020-10-07T16:29:58Z")

</div>

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
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:

```julia
   @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"

```
