I am trying to create a contourf() plot where the lowest contour level is not being colored. I want to overlap multiple contour plots so I do not want the lowest level of contour 2 to overlap contour 1.
I am using GR in Plots.jl and StatsPlots.jl to plot a BivariateKDEDensity from KernelDensity.jl.
My initial thought was to create a colormap where the first entry is :transparent
cgrad([:transparent, :red, :blue], categorical = true):
This looks like the first level is black. This does not work:
(Note that I’ve set the alpha here in order to be able to actually see contour #1).
I’ve also tried
cgrad([:black, :red, :blue], alpha=[0, 1, 1], categorical = true):
But the result is the same.
Here’s a MWE:
import Plots using StatsPlots using KernelDensity U1 = kde(rand(100, 2)) U2 = kde(rand(100, 2)) Plots.plot(U1, color=:black, colorbar=false, linewidth=2, levels=4) Plots.contourf!(U2, color=cgrad([:transparent, :red, :blue], categorical = true), levels=2, alpha=0.5)
Is this a limitation of GR or am I missing something?