# Plot.jl throws "broken pipe" after closing window with gr() backend

**URL:** https://discourse.julialang.org/t/plot-jl-throws-broken-pipe-after-closing-window-with-gr-backend/35873
**Category:** General Usage
**Created:** [March 12, 2020, 9:35am UTC](https://discourse.julialang.org/t/plot-jl-throws-broken-pipe-after-closing-window-with-gr-backend/35873 "2020-03-12T09:35:12Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![zierenberg](https://avatars.discourse-cdn.com/v4/letter/z/278dde/32.png) [@zierenberg](https://discourse.julialang.org/u/zierenberg)
#### Post date: [March 12, 2020, 9:35am UTC](https://discourse.julialang.org/t/plot-jl-throws-broken-pipe-after-closing-window-with-gr-backend/35873/1 "2020-03-12T09:35:13Z")

</div>

Hi,  
I am wondering whether the following is a bug or an error in my installation. I use Plots.jl with the gr() backend and do the following MWE

```julia
julia> using Plots
julia> plot(rand(4,4))

```

then I close the QT window with the plot and try to plot again to observe

```julia
julia> plot(rand(4,4))
send: Broken pipe

```

After this, the REPL is practically useless for plotting.

If instead, I used the pyplot() backend, it works [until I change to gr()]

```julia

julia> using Plots

julia> pyplot()
Plots.PyPlotBackend()

julia> plot(rand(4,4)) #close window

julia> plot(rand(4,4)) #close window

julia> plot(rand(4,4)) #close window

julia> gr()
Plots.GRBackend()

julia> plot(rand(4,4)) #close window

julia> plot(rand(4,4))
send: Broken pipe

```

My installation (julia 1.2 and 1.3 on linux) is up-to-date for all I know:

```julia
  [91a5bcdd] Plots v0.29.6
  [d330b81b] PyPlot v2.8.2
  [1fd47b50] QuadGK v2.3.1

```

Any idea what is going wrong? Especially since gr() is the default backend.  
Cheers

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [March 12, 2020, 10:00am UTC](https://discourse.julialang.org/t/plot-jl-throws-broken-pipe-after-closing-window-with-gr-backend/35873/2 "2020-03-12T10:00:15Z")

</div>

I think @jheinen mentioned that this is fixed in the next release - for now I believe you have to restart the Julia session.

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [March 12, 2020, 10:27am UTC](https://discourse.julialang.org/t/plot-jl-throws-broken-pipe-after-closing-window-with-gr-backend/35873/3 "2020-03-12T10:27:11Z")

</div>

Nope, `closeall()` let’s you plot again.

---

<div class="post-metadata">

### Author: ![zierenberg](https://avatars.discourse-cdn.com/v4/letter/z/278dde/32.png) [@zierenberg](https://discourse.julialang.org/u/zierenberg)
#### Post date: [March 12, 2020, 10:57am UTC](https://discourse.julialang.org/t/plot-jl-throws-broken-pipe-after-closing-window-with-gr-backend/35873/4 "2020-03-12T10:57:17Z")

</div>

Indeed, `closeall()` is a nice workaround!

I would still be curious if this will be fixed or not in the long run? In fact, when looking at the github repository, I did not find an issue on this (maybe I looked for the wrong keywords though).

---

<div class="post-metadata">

### Author: ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)
#### Post date: [March 12, 2020, 4:07pm UTC](https://discourse.julialang.org/t/plot-jl-throws-broken-pipe-after-closing-window-with-gr-backend/35873/5 "2020-03-12T16:07:52Z")

</div>

The problem is fixed in the development branch and will be tagged tomorrow.

---

<div class="post-metadata">

### Author: ![zierenberg](https://avatars.discourse-cdn.com/v4/letter/z/278dde/32.png) [@zierenberg](https://discourse.julialang.org/u/zierenberg)
#### Post date: [March 12, 2020, 7:03pm UTC](https://discourse.julialang.org/t/plot-jl-throws-broken-pipe-after-closing-window-with-gr-backend/35873/6 "2020-03-12T19:03:36Z")

</div>

Thank you all for the answers!

---

<div class="post-metadata">

### Author: ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)
#### Post date: [March 12, 2020, 7:07pm UTC](https://discourse.julialang.org/t/plot-jl-throws-broken-pipe-after-closing-window-with-gr-backend/35873/7 "2020-03-12T19:07:16Z")

</div>

Thanks for asking about this - I ran into it this morning
