# Trying to get pyplot backend to Plots, but end up with GKS plots anyway

**URL:** <https://discourse.julialang.org/t/trying-to-get-pyplot-backend-to-plots-but-end-up-with-gks-plots-anyway/22038>\
**Category:** Visualization\
**Tags:** plotting, pyplot\
**Created:** [March 19, 2019, 12:47pm UTC](https://discourse.julialang.org/t/trying-to-get-pyplot-backend-to-plots-but-end-up-with-gks-plots-anyway/22038 "2019-03-19T12:47:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeonNeon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/neonneon/32/7487_2.png) [@NeonNeon](https://discourse.julialang.org/u/NeonNeon)\
**Post date:** [March 19, 2019, 12:47pm UTC](https://discourse.julialang.org/t/trying-to-get-pyplot-backend-to-plots-but-end-up-with-gks-plots-anyway/22038/1 "2019-03-19T12:47:16Z")

</div>

I have several problems using the Plots package together with the PyPlot backend.

My exmple looks like this, I have two packages MyPlot and MyFront.  
In MyPlot’s environment I have added Plots and PyPlot as dependencies and the code looks like this:

```julia
module MyPlot

using Plots
pyplot()
export myplot

function myplot(x)
    # Plotting using Plots with Pyplot as backend
    plot(x)
end

end # module

```

In MyFront (which is my “application-code”) I use `pkg> dev MyPlot` to create a dependency.  
If I now try to yse the MyPlot package, I get a LoadError: `ArgumentError: Package PyPlot not found in current path:....` when precompiling MyPlot.

This is the first question: I thought that since MyPlot has a dependancy on PyPlot, MyFront didn’t have to include it too?

Anyway, if I do `MyFront> add PyPlot` before doing `using MyPlot` the precompilation seems to work, but when I call `myplot(rand(10))` I do not get the pyplot backend, instead I get a plot with the title GKS QtTerm, I think this is the GR backend? So my second question is why I dont seem to get the pyplot backend when doing this plot.

Furthermore, If I do `MyFront> add Plots` followed by `using Plots; pyplot()` and then call `myplot`, the backend switch seems to work.

```julia
julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202* (2019-01-21 21:24 UTC)
Platform Info:
  OS: Linux (x86_64-redhat-linux)

(MyPlot) pkg> st
Project MyPlot v0.1.0
    Status `~/backendtest/MyPlot/Project.toml`
  [91a5bcdd] Plots v0.23.2
  [d330b81b] PyPlot v2.8.0

```

---

<div class="post-metadata">

**Author:** ![fishy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fishy/32/10822_2.png) [@fishy](https://discourse.julialang.org/u/fishy)\
**Post date:** [October 21, 2019, 12:07am UTC](https://discourse.julialang.org/t/trying-to-get-pyplot-backend-to-plots-but-end-up-with-gks-plots-anyway/22038/2 "2019-10-21T00:07:19Z")

</div>

Hiya,

I know this is quite some time down the line, but I have found exactly the same issue, did you ever work this one out?

Cheers

---

<div class="post-metadata">

**Author:** ![NeonNeon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/neonneon/32/7487_2.png) [@NeonNeon](https://discourse.julialang.org/u/NeonNeon)\
**Post date:** [October 22, 2019, 10:53am UTC](https://discourse.julialang.org/t/trying-to-get-pyplot-backend-to-plots-but-end-up-with-gks-plots-anyway/22038/3 "2019-10-22T10:53:27Z")

</div>

I haven’t touched Julia for quite some time now. I never got this issue to work properly.  
I am interested if you find out what the problem is/was, so please update the thread if you manage to.

Best
