Closed yebai closed 2 weeks ago
I looked into this, and it's a classic problem. Plots.jl checks that the widths add up to 1 using:
if sum(widths) != 1
error("The sum of widths must be 1!")
end
With the example in the docs
using MCMCChains
using StatsPlots
# Define the experiment
n_iter = 100
n_name = 3
n_chain = 2
# experiment results
val = randn(n_iter, n_name, n_chain) .+ [1, 2, 3]'
val = hcat(val, rand(1:2, n_iter, 1, n_chain))
# construct a Chains object
chn = Chains(val, [:A, :B, :C, :D])
corner(chn)
it turns out that
widths = [0.3, 0.3, 0.3, 0.1]
and ...
julia> 0.3 + 0.3 + 0.3 + 0.1
0.9999999999999999
Upstream PR: https://github.com/JuliaPlots/Plots.jl/pull/4972
Merged now, will be fixed with the next release of Plots.jl
The following example errors. It seems the issue is from upper stream packages instead of
MCMCChains
.Note that the
corner
plot works fine when the number of variables is smaller than 3.