# Plots.jl add colorbar when plotting Shape

**URL:** <https://discourse.julialang.org/t/plots-jl-add-colorbar-when-plotting-shape/22544>\
**Category:** Visualization\
**Created:** [March 30, 2019, 2:51pm UTC](https://discourse.julialang.org/t/plots-jl-add-colorbar-when-plotting-shape/22544 "2019-03-30T14:51:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![andferrari](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andferrari/32/7715_2.png) [@andferrari](https://discourse.julialang.org/u/andferrari)\
**Post date:** [March 30, 2019, 2:51pm UTC](https://discourse.julialang.org/t/plots-jl-add-colorbar-when-plotting-shape/22544/1 "2019-03-30T14:51:32Z")

</div>

I am plotting in the same plot multiple `Shape()`, each with a different fill color.  
How can I add a colorbar for these colors to the plot ?

---

<div class="post-metadata">

**Author:** ![yha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yha/32/3502_2.png) [@yha](https://discourse.julialang.org/u/yha)\
**Post date:** [March 30, 2019, 9:22pm UTC](https://discourse.julialang.org/t/plots-jl-add-colorbar-when-plotting-shape/22544/2 "2019-03-30T21:22:46Z")

</div>

If you use the `fill_z` keyword you should get a colorbar, e.g.

```julia
plot([Shape(rand(3), rand(3)) for i=1:5], fill_z=rand(5))

```

---

<div class="post-metadata">

**Author:** ![andferrari](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andferrari/32/7715_2.png) [@andferrari](https://discourse.julialang.org/u/andferrari)\
**Post date:** [March 30, 2019, 10:48pm UTC](https://discourse.julialang.org/t/plots-jl-add-colorbar-when-plotting-shape/22544/3 "2019-03-30T22:48:07Z")

</div>

Thanks for your help.

I would like to hide the black lines around the shapes.  
But when I set `linealpha=0` the colorbar disappears.

`plot([Shape(rand(3), rand(3)) for i=1:5], fill_z=rand(5), linealpha=0)`

I have tried `linewidth=0` without success.

---

<div class="post-metadata">

**Author:** ![yha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yha/32/3502_2.png) [@yha](https://discourse.julialang.org/u/yha)\
**Post date:** [March 31, 2019, 2:57pm UTC](https://discourse.julialang.org/t/plots-jl-add-colorbar-when-plotting-shape/22544/4 "2019-03-31T14:57:35Z")

</div>

Seems like a bug. As a workaround, you can have lines of the same color as the shapes, e.g.

```julia
z = rand(5)
plot([Shape(rand(3), rand(3)) for i=1:5], fill_z=z, line_z=z)

```

---

<div class="post-metadata">

**Author:** ![andferrari](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andferrari/32/7715_2.png) [@andferrari](https://discourse.julialang.org/u/andferrari)\
**Post date:** [March 31, 2019, 6:10pm UTC](https://discourse.julialang.org/t/plots-jl-add-colorbar-when-plotting-shape/22544/5 "2019-03-31T18:10:03Z")

</div>

`line_z` works perfectly! Many thanks!

I will open an issue for `linealpha`.
