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

Dear community!

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

How do I do that with Plots?

My code is something similar to:

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

Where relevant data is:


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.