The root cause seems to be inconsistent behaviour for palette() (but I might be wrong on that).
using Plots
Plots.GRBackend()
function f(x, y)
r = sqrt(x^2 + y^2)
return cos(r) / (1 + r)
end
x = range(0, 2π, length = 30)
pal = palette(:RdBu_11)
contour(x, x, f, fill=(true,pal))
This works fine for me from the REPL, but when I use Pluto (and it seems when the user above uses the REPL) it throws an error
MethodError: no method matching _as_gradient(::Array{ColorTypes.RGBA{Float64},1})
Closest candidates are:
_as_gradient(!Matched::PlotUtils.ColorGradient) at /Users/weymouth/.julia/packages/Plots/8GUYs/src/utils.jl:136
_as_gradient(!Matched::ColorTypes.Colorant) at /Users/weymouth/.julia/packages/Plots/8GUYs/src/utils.jl:137
julia> Pkg.status("Plots")
Status `~/Julia/workspace/Project.toml`
[91a5bcdd] Plots v1.14.0
julia> Pkg.status("GR")
Status `~/Julia/workspace/Project.toml`
[28b8d3ca] GR v0.57.4
Have you tried in a completely clean environment? Start with new Project.toml and Manifest.toml files and for good measure delete any old versions of Pluto, Plots and GR packages inside .julia/packages/ before reinstalling them.