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

plotting
pyplot
#1

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:

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> 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
0 Likes