# GR plots not shown in own GUI when using Atom

**URL:** https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551
**Category:** General Usage
**Tags:** juno, plotting
**Created:** [August 16, 2018, 7:57am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551 "2018-08-16T07:57:17Z")
**Posts on this page:** 14
**Page:** 1

<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: [August 16, 2018, 7:57am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/1 "2018-08-16T07:57:17Z")

</div>

When using julia v0.7 and plotting using `Plots/gr()` from Atom, plots refuse to show in the GR gui. If I have plot pane enabled, they show up in the plot pane, when I deselect plot pane, they never show up. In julia 0.6 I had a similar issue which was solved by calling `closeall(); gui()` after creating a plot, which no longer works on v0.7. Plots from `pyplot()` show up just fine.

Package status for reference

```julia
(v0.7) pkg> st
    Status `~/.julia/environments/v0.7/Project.toml`
  [c52e3926] Atom v0.7.3
  [28b8d3ca] GR v0.32.2
  [e5e0dc1b] Juno v0.5.2
  [b964fa9f] LaTeXStrings v1.0.2
  [3b7a836e] PGFPlots v2.2.2
  [995b91a9] PlotUtils v0.5.2
  [58dd65bb] Plotly v0.1.1
  [91a5bcdd] Plots v0.19.2
  [438e738f] PyCall v1.17.1
  [d330b81b] PyPlot v2.6.0
  [3cdcf5f2] RecipesBase v0.5.0+ [`~/.julia/dev/RecipesBase`]

```

---

<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: [August 16, 2018, 8:38am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/2 "2018-08-16T08:38:04Z")

</div>

GR v0.32.3 should work

---

<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: [August 16, 2018, 8:43am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/3 "2018-08-16T08:43:21Z")

</div>

I just updated and now experience a completely different error, bnoth in atom and in REPL

```julia
               _
   _ _ _(_)_ | A fresh approach to technical computing
  (_) | (_) (_) | Documentation: https://docs.julialang.org
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 0.7.0 (2018-08-08 06:46 UTC)
 _/ |\ __'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu

julia> using Plots

julia> gr()
Plots.GRBackend()

julia> plot(randn(10))
ERROR: error compiling _plot!: error compiling _display: could not load library "libGR.so"
libGR.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] #plot#134(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Array{Float64,1}) at /local/home/fredrikb/.julia/packages/Plots/LWBTU/src/plot.jl:57
 [2] plot(::Array{Float64,1}) at /local/home/fredrikb/.julia/packages/Plots/LWBTU/src/plot.jl:51
 [3] top-level scope at none:0

```

---

<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: [August 16, 2018, 8:55am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/4 "2018-08-16T08:55:58Z")

</div>

I have no idea, why this file is (suddenly) missing. Could you please try to rebuild GR:

```julia
ENV["GRDIR"]=""
Pkg.build("GR")

```

This should download the GR run-time libraries (including libGR.so) again.

---

<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: [August 16, 2018, 8:58am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/5 "2018-08-16T08:58:41Z")

</div>

Thanks! That did the trick 😃

---

<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: [August 16, 2018, 9:16am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/6 "2018-08-16T09:16:23Z")

</div>

Actually, v0.32.3 did not solve the original problem, I still get no plots from atom when using Plots.jl 😕  
Using GR directly gives me plots in the plot pane, even though I have disabled the plot pane

```julia
julia> using Plots

julia> gr()
Plots.GRBackend()

julia> plot(randn(10))

julia> gui()

```

---

<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: [August 16, 2018, 9:48am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/7 "2018-08-16T09:48:01Z")

</div>

Hmm - works fine for me.

 ![55](https://global.discourse-cdn.com/julialang/original/3X/e/5/e5438f6ee39b8640c84014cf3e0c38f172f8fa23.png)  
Could you please try this example:

```julia
using Plots
gr()
for i in 1:100
  display(histogram(randn(10000)))
end

```

The plot pane is currently the default target (within Atom). To disable it, the display mechanism in GR has to be changed …

---

<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: [August 16, 2018, 9:50am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/8 "2018-08-16T09:50:09Z")

</div>

> [@jheinen](#):
>
> using Plots gr() for i in 1:100 display(histogram(randn(10000))) end

Yes, nothing happens. I have plot-pane disabled and no GUI is shown. The plots are shown just fine if I enable the plot pane, which I do not want to do.

---

<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: [August 16, 2018, 9:54am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/9 "2018-08-16T09:54:17Z")

</div>

I could change GR’s behaviour if I can obtain the user’s setting for the plot-pane. I’ll check this later …

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [August 16, 2018, 10:12am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/10 "2018-08-16T10:12:07Z")

</div>

I’m in the process of redesigning Plots.jl’s and GR’s display system such that it works well with Juno.  
Both of those packages don’t really make use of Base’s display system, which is kind of unfortunate.

PR for Plots.jl:  
[https://github.com/JuliaPlots/Plots.jl/pull/1667](https://github.com/JuliaPlots/Plots.jl/pull/1667)

GR should imho follow the same design – push a `GRDisplay <: AbstractDisplay` to the Base display stack and provide the correct `show` and `display` methods. That would probably require a bit of a redesign of GR because e.g. `plot()` returns `nothing` instead of something Juno (or the REPL) can call `show` on.

* * *

Short description of how Juno handles plots right now:

1. We push a `JunoDisplay` to the top of the display stack.
2. `display(::JunoDisplay, x)` catches _everything_.
3. If there’s an appropriate `show` method for `x` _and_ the plot pane is enabled in the settings we display `x` in the plot pane (by calling `show` on it). “Appropriate `show` method” means most image mime types ( `image/svg+xml`, `image/png`, `image/jpeg`, `image/tiff`, `image/bmp`, `image/gif`) as well as `application/juno+plotpane` which allows you to use arbitrary HTML.
4. If there’s no appropriate `show` method _or_ the plot pane is disabled we don’t do anything and let the rest of the display stack handle displaying the plot. This is where `PlotsDisplay` (or the hypothetical `GRDisplay`) comes is relevant.

---

<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: [August 16, 2018, 10:26am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/11 "2018-08-16T10:26:20Z")

</div>

This was my idea for GR:

```julia
if Main.Atom.PlotPaneEnabled[] == true
    Main.Atom.render(Main.Atom.PlotPane(), content)
    return nothing
else
    return content
end

```

… but where/how can I disable the PlotPane to test it?

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [August 16, 2018, 10:28am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/12 "2018-08-16T10:28:40Z")

</div>

There’s a checkbox in the julia-client settings.

But I don’t really like this solution tbh, because there shouldn’t be any need for you to have any kind of dependency on Atom.jl. If you provide the correct `show` and `display` methods everything will just work fine without any package interdependencies.

Edit: My previous post wasn’t _quite_ correct btw – we don’t make sure that `JunoDisplay` is on the top of the stack in the released version.

---

<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: [August 16, 2018, 10:45am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/13 "2018-08-16T10:45:09Z")

</div>

Ok - thanks for the info.

I’ll push a short-term solution - but you’re right, I’ll have to improve the show and display methods …

---

<div class="post-metadata">

### Author: ![j2b2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j2b2/32/3387_2.png) [@j2b2](https://discourse.julialang.org/u/j2b2)
#### Post date: [November 13, 2018, 10:35am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551/14 "2018-11-13T10:35:54Z")

</div>

Hello,

I discover today the option “Enable Plot Pane” in julia-client settings, but after unchecking it, I have the same problem as OP (plots never show up with GR backend), three months later ☹

```julia
(v1.0) pkg> st -m
    [c52e3926] Atom v0.7.10
    [28b8d3ca] GR v0.35.0
    [e5e0dc1b] Juno v0.5.3
    [91a5bcdd] Plots v0.21.0

```

Amitiés
