I am trying to plot multiple groups of series from a dataframe, distinguish the group by line attribute and the individual serie by colour.
The problem is that, although I define my own palette, only the first group of series complies with it:
using DataFrames, Plots, StatPlots df = DataFrame( product = ["orange","orange","orange","orange","banana","banana","banana","banana"], year = [2010,2011,2012,2013,2010,2011,2012,2013], prod = [120,150,170,160,100,130,165,158], cons = [70,90,100,95, 80,95,110,120] ) plotlyjs() # same with pyplot() backend.. mycolors = [:blue, :red ] # same with mycolors = [:yellow, :orange ] fruits_plot = plot(df, :year, :prod, group=:product, linestyle = :solid, linewidth=3, linecolor=:match, color_palette = mycolors) fruits_plot = plot!(df, :year, :cons, group=:product, linestyle = :dot, linewidth=3, linecolor=:match, color_palette = mycolors)
As you can see, the second group of series is using the palette, but with somehow “distorted” colours.
It’s not because it’s a :dot (I did try with :solid for the second group of series too).
Am I doing something wrong, or you think it’s a bug in the Plots package?
On a side note, would it be possible to force adding a prefix to the legend, so I could write "Production of " for the first group and "Consumption of " for the second one ?..