# Unusual behaviour with non-uniform level for a contour plot

**URL:** https://discourse.julialang.org/t/unusual-behaviour-with-non-uniform-level-for-a-contour-plot/106227
**Category:** Visualization
**Tags:** plotting
**Created:** [November 14, 2023, 5:32pm UTC](https://discourse.julialang.org/t/unusual-behaviour-with-non-uniform-level-for-a-contour-plot/106227 "2023-11-14T17:32:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jreaso](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jreaso/32/203726_2.png) [@jreaso](https://discourse.julialang.org/u/jreaso)
#### Post date: [November 14, 2023, 5:32pm UTC](https://discourse.julialang.org/t/unusual-behaviour-with-non-uniform-level-for-a-contour-plot/106227/1 "2023-11-14T17:32:41Z")

</div>

When I pass a non-uniform level to a contour plot, the color bar acts as expected, but the actual contour plot is colored incorrectly. Is there a way around this?

As an example, using uniform levels `l1`:

```julia
using Plots

x = y = collect(0:0.001:1)
f(x,y) = exp(x+1)*exp(y+1)*(x-y^3)

l1 = -20:2.5:30
contourf(x, y, f, c=:turbo, levels=l1)

```

we get:

 ![Screenshot 2023-11-14 at 17.28.42](https://global.discourse-cdn.com/julialang/original/3X/0/1/01ae3067bb2987a605fc85a6fe45a5b3f418e913.png)

But then changing to non-uniform levels `l2`:

```julia
l2 = [-20:1:0..., 5:5:30...]
contourf(x, y, f, c=:turbo, levels=l2)

```

we get:

 ![Screenshot 2023-11-14 at 17.28.49](https://global.discourse-cdn.com/julialang/original/3X/0/5/053c36fb854a00c7858cb32e1ebce3492f475b75.png)

Is this a bug or is this intentional behaviour I misunderstood? Is there a way to get around this?
