Confidence interval with Plots and pgfplots()

Hi,

I would like to run this type of code

using Plots 
pgfplots()
aa = rand(10)
bb = rand(10)
cc = rand(10)
conf = [aa-cc bb-cc]
p = plot(collect(1:10),cc)
plot!(cc,ribbon=conf)

This code works well is I replace pgfplots() with pyplot(). Basically, I can’t find a way to plot confidence intervals with pgfplots().

Not all backends support all series and attributes, you can check which ones are supported here:

https://docs.juliaplots.org/latest/supported/

This shows that indeed the pgfplots backends does not currently support ribbon

Thank you. Any chance ribbon will be added to pgfplots()? I don’t know who is in charge of the package but it could be nice.

I just added that to the upcoming PGFPlotsX backend. You could try that already out by add https://github.com/BeastyBlacksmith/Plots.jl#pgfplotsx.
Don’t hesitate to ping me, if you run into any issues.

2 Likes

Awesome, thanks! Can you explain how exactly I can try it? since you said upcoming, I assume it is not there yet. When will it become available like any other backend?

Spectacular! We have been using that package directly but would love to use Plots frontend instead.
What is the timeline for that backend? Is the current PGFPlots moving to deprecated status?

Its in the finishing phase. What it needs most now are brave souls who checkout the development branches and report whats is still missing.

add https://github.com/BeastyBlacksmith/Plots.jl#pgfplotsx
add PGFPlotsX#master

They will coexist for a while until it is sure that they are functionally equivalent.

1 Like

Its out. Give it a try and I would love to get some feedback.
Best to report bugs/whishes in the meta issue.

Great, thanks. Still, how can we use it?

using Plots
pgfplotsx()

says pgfplotsx is not defined–while I don’t get this error with pgfplots() or pyplots()

It is merged and will come with the next release.
Meanwhile you can use it by

] add Plots#master
1 Like

It is now released.

] add Plots PGFPlotsX
using Plots; pgfplotsx()
3 Likes

Should I find it there already? pgfplotsx() gives “not defined”

What is your Plots version? It is part of Plots v0.28.2.

Got it, I am running 0.27.0. The thing is, it doesn’t let me update it (which is weird, because I just downloaded Julia 1.3 without explicitly imposing requirements)

Pkg.add(Pkg.PackageSpec(;name="Plots", version="0.28.2"))
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package Plots [91a5bcdd]:
 Plots [91a5bcdd] log:
 ├─possible versions are: [0.12.1-0.12.4, 0.13.0-0.13.1, 0.14.0-0.14.2, 0.15.0-0.15.1, 0.16.0, 0.17.0-0.17.4, 0.18.0, 0.19.0-0.19.3, 0.20.0-0.20.6, 0.21.0, 0.22.0-0.22.5, 0.23.0-0.23.2, 0.24.0, 0.25.0-0.25.3, 0.26.0-0.26.3, 0.27.0] or uninstalled
 └─restricted to versions 0.28.2 by an explicit requirement — no versions left
Stacktrace:
 [1] check_constraints(::Pkg.GraphType.Graph) at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/GraphType.jl:937
 [2] Pkg.GraphType.Graph(::Dict{Base.UUID,Set{VersionNumber}}, ::Dict{Base.UUID,Dict{Pkg.Types.VersionRange,Dict{String,Base.UUID}}}, ::Dict{Base.UUID,Dict{Pkg.Types.VersionRange,Dict{String,Pkg.Types.VersionSpec}}}, ::Dict{Base.UUID,String}, ::Dict{Base.UUID,Pkg.Types.VersionSpec}, ::Dict{Base.UUID,Pkg.Types.Fixed}, ::Bool) at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/GraphType.jl:364
 [3] deps_graph(::Pkg.Types.Context, ::Dict{Base.UUID,String}, ::Dict{Base.UUID,Pkg.Types.VersionSpec}, ::Dict{Base.UUID,Pkg.Types.Fixed}) at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/Operations.jl:437
 [4] resolve_versions!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/Operations.jl:320
 [5] #add#112(::Bool, ::Pkg.BinaryPlatforms.MacOS, ::typeof(Pkg.Operations.add), ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}) at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/Operations.jl:1010
 [6] #add at ./none:0 [inlined]
 [7] #add#25(::Bool, ::Pkg.BinaryPlatforms.MacOS, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(Pkg.API.add), ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/API.jl:102
 [8] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/API.jl:72
 [9] #add#20 at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/API.jl:69 [inlined]
 [10] add(::Pkg.Types.PackageSpec) at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/API.jl:66
 [11] top-level scope at none:0

I can’t replicate that. Does this also happen if you activate a new environment?
Like

] activate clean
add Plots@0.28.2

Also updating the previous environment could help.

Are you using JuliaPro? Perhaps that registry updated.

I am using Julia + Atom. Using

activate clean 

doesn’t fix the problem.

Maybe I should try JuliaPro

I am bit confused on how you can get Plots 0.28.2. Shall I delete and re-install Julia? Change the registry somehow?

You can try registry rm General and then registry add General in the Pkg REPL mode.