I use the following for plotting with Plots.jl:
using Plots
using HDF5
using Statistics
all_predictions = []
all_trueValues = []
h5open("3to12benchmark_corrected_r.dat", "r") do fid
for qn in 3:10
predictions = []
trueValues = []
for runi in 1:3
push!(predictions, read(fid[string("predictionArray",qn,"q", runi)]))
push!(trueValues, read(fid[string("truePredictionArray", qn, "q", runi)]))
end
push!(all_predictions, trueValues)
push!(all_trueValues, predictions)
end
limits = [-0.7, 0.7]
trueRelationX, trueRelationY = collect(limits[1]-1:limits[2]+1), collect(limits[1]-1:limits[2]+1)
num_measurements = 400
err = sqrt(1/num_measurements) *sqrt(3^3) #Chebyshev
p = [3,5,8,10]
#Using Subplots:
l = @layout grid(2,2){0.5w}
plt = plot( titlefont=5,
labelfont=5,
legend=false,
layout=l)
for (pi,pe) in enumerate(p)
plot!(plt[pi], trueRelationX, trueRelationY .- err,
fillrange=trueRelationY .+ err,
fillalpha= 0.1,
fillcolor="blue",
linealpha=0.1,
label="1-sigma",
markersize=1,
xlabel="True expectation",
ylabel="Estimated expectation"
)
#Plot the linear y=x line for orientation
plot!(plt[pi],trueRelationX, trueRelationY,
linecolor=:black,
linestyle=:dash,
guidefontsize = 8
)
for runi in 1:3
plot!(plt[pi], all_trueValues[pe .- 2][runi], all_predictions[pe .- 2][runi],
seriestype = :scatter,
label="Iteration $runi",
legend=false,
title=["a", "b", "c", "d"][pi],
xlim = [-1/sqrt(pi), 1/sqrt(pi)],
ylim = [-1/sqrt(pi), 1/sqrt(pi)])
end
end
display(plt)
end
My problem is that running this gives:
so the top-left figure gets a fill that shoots over the x-axis (and just doesn’t hit the y-axis). Can anyone say what I am possibly doing wrong here? Or is this probably a bug? I got this in similar plots already so I am not sure how common this is.
(As there is no direct upload function here, the code runs directly with this datafile: 3to12benchmark_corrected_r.dat - Google Drive)