# Transparancy in colormap / removing contour level

**URL:** <https://discourse.julialang.org/t/transparancy-in-colormap-removing-contour-level/88283>\
**Category:** Visualization\
**Created:** [October 5, 2022, 10:53am UTC](https://discourse.julialang.org/t/transparancy-in-colormap-removing-contour-level/88283 "2022-10-05T10:53:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Janssena](https://avatars.discourse-cdn.com/v4/letter/j/dfb087/32.png) [@Janssena](https://discourse.julialang.org/u/Janssena)\
**Post date:** [October 5, 2022, 10:53am UTC](https://discourse.julialang.org/t/transparancy-in-colormap-removing-contour-level/88283/1 "2022-10-05T10:53:54Z")

</div>

Hey All,

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)`:

![cgrad_1](https://global.discourse-cdn.com/julialang/original/3X/f/c/fc393f470ce74a0cfb15d9591190040eb413582f.png)

This looks like the first level is black. This does not work:

![res](https://global.discourse-cdn.com/julialang/original/3X/4/d/4dc5b33dd35e3bdf02d2b6e4442dc767ba7633a1.png)

(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)`:  
 ![cgrad_2](https://global.discourse-cdn.com/julialang/original/3X/3/5/35da81bc25fd3c94841552f034903c89034eb3b4.png)

But the result is the same.

Here’s a MWE:

```julia
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?
