# Fix contour colors scale

**URL:** <https://discourse.julialang.org/t/fix-contour-colors-scale/33767>\
**Category:** Visualization\
**Tags:** plotting\
**Created:** [January 24, 2020, 10:02pm UTC](https://discourse.julialang.org/t/fix-contour-colors-scale/33767 "2020-01-24T22:02:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedrohnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pedrohnv/32/212503_2.png) [@pedrohnv](https://discourse.julialang.org/u/pedrohnv)\
**Post date:** [January 24, 2020, 10:02pm UTC](https://discourse.julialang.org/t/fix-contour-colors-scale/33767/1 "2020-01-24T22:02:16Z")

</div>

Hello,  
I would like to show an animation of a contour plot. For better visualization, it would be ideal if I could fix the colorbar in addition to the levels.

Example:

```nohighlight
    using Plots
    anim = @animate for i=0:10
        contour(x, y, (x, y) -> ((x - i)^2 + y^2), levels=0:100:1500,
		        contour_labels=true, colorbar_entry=true, line_z=0:100:1000)
    end
    gif(anim, "/tmp/anim1.gif", fps = 3)

```

By looking at the [attributes](https://docs.juliaplots.org/latest/attributes/), I thought that setting the `line_z` parameters was the way to go, but it had no effect. How could I fix the colobar in this animation?

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [January 25, 2020, 12:06am UTC](https://discourse.julialang.org/t/fix-contour-colors-scale/33767/2 "2020-01-25T00:06:18Z")

</div>

Use `clims`

---

<div class="post-metadata">

**Author:** ![pedrohnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pedrohnv/32/212503_2.png) [@pedrohnv](https://discourse.julialang.org/u/pedrohnv)\
**Post date:** [January 27, 2020, 5:38pm UTC](https://discourse.julialang.org/t/fix-contour-colors-scale/33767/3 "2020-01-27T17:38:52Z")

</div>

That works, thank you.

Example:

```nohighlight
using Plots
x = y = -25:1:25;
begin
    anim = @animate for i=0:10
		contourf(x, y, (x, y) -> ((x - i)^2 + y^2), c=:plasma, levels=9, clims=(0,1000))
	end
    gif(anim, "/tmp/anim1.gif", fps = 2)
end

```
