# How to make a custom (/manual) legend with Plots.jl?

**URL:** <https://discourse.julialang.org/t/how-to-make-a-custom-manual-legend-with-plots-jl/51579>\
**Category:** Visualization\
**Created:** [December 10, 2020, 2:45am UTC](https://discourse.julialang.org/t/how-to-make-a-custom-manual-legend-with-plots-jl/51579 "2020-12-10T02:45:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bvilmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvilmann/32/19775_2.png) [@bvilmann](https://discourse.julialang.org/u/bvilmann)\
**Post date:** [December 10, 2020, 2:45am UTC](https://discourse.julialang.org/t/how-to-make-a-custom-manual-legend-with-plots-jl/51579/1 "2020-12-10T02:45:30Z")

</div>

Dear community!

I want to make a common (/manual) legend for my plot for the various “types” of production units.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/e/be0af18c24f4b11e63ecae472680f86d5ba80c35.png)

How do I do that with Plots?

My code is something similar to:

```julia
groupedbar(
   hcat(C'-P', P',zeros(N,1),zeros(N,1)),
   color = unique(clr),
   label = unique(lab),
   xtick=1:N
   )

```

Where relevant data is:

```julia

clr = [
   RGB(0.2,0.2,0.2), # Black / dark grey
   RGB(255/255,140/255,25/255), # Carrot
   RGB(133/255,94/255,66/255), # Brown
   RGB(128/255,212/255,255/255), # Light blue
   RGB(255/255,247/255,0/255), # Yellow
   RGB(128/255,212/255,255/255), # Light blue
   RGB(133/255,94/255,66/255), # Brown
   RGB(25/255,102/255,255/255), # Blue
   RGB(255/255,0/255,0/255), # Red
   RGB(0.2,0.2,0.2), # Black / dark grey
   ]
lab = ["" "Coal" "Gas" "Lignite" "Wind" "PV" "Wind" "Lignite" "Hydro" "Nuclear" "Coal"]
C = [200 250 300 400 500 600 700 800 900 1000]
P = [200.0 250.0 300.0 400.0 500.0 600.0 586.5 200.0 0.0 0.0]

```

My immediate problem is that it accepts my array as a string. Have I misunderstood some syntax or is this intended behavior?

If not, can you point me in a direction in which I can proceed with this issue regarding the source files of Plots? I had a little trouble tracing the invoking method.

I have tried a lot of workarounds and I don’t think any of the approaches is very nice (since I failed in achieving what I wanted).

All the best!  
Benjamin

_PS: There is not much documentation on bar plots - and pie charts that share the same difficulty expressed above._
