# Makie add manual legend

**URL:** https://discourse.julialang.org/t/makie-add-manual-legend/107821
**Category:** Visualization
**Tags:** makie
**Created:** [December 19, 2023, 3:02pm UTC](https://discourse.julialang.org/t/makie-add-manual-legend/107821 "2023-12-19T15:02:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Nosferican](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nosferican/32/9275_2.png) [@Nosferican](https://discourse.julialang.org/u/Nosferican)
#### Post date: [December 19, 2023, 3:02pm UTC](https://discourse.julialang.org/t/makie-add-manual-legend/107821/1 "2023-12-19T15:02:27Z")

</div>

I have a plot such as `barplot(1:3, 2:4, color = [:red, :blue, :red])` and would like to add a legend such that the `red => "A"` and `blue => "B"`, how could I accomplish that?

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [December 19, 2023, 4:27pm UTC](https://discourse.julialang.org/t/makie-add-manual-legend/107821/2 "2023-12-19T16:27:13Z")

</div>

If you have array-valued colors you currently have to build legends manually, unfortunately.

```julia
f, ax, bp = barplot(1:3, 2:4, color = [:red, :blue, :red])
Legend(f[1, 2], [PolyElement(color = :red), PolyElement(color = :blue)], ["A", "B"])
f

```

 ![grafik](https://global.discourse-cdn.com/julialang/original/3X/5/b/5bd7aa9cb004fc4a85fdcb5b62842233f06c8b90.png)
