Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Legend group names

Is it possible to get Plotly to add names for different traces in the legend?

I’m looking for something equivalent to ggplots functionality:

 scale_fill_manual(values = colpal, name ="Realised")
 scale_color_manual(values = colpal, name = "Budget")

Which then would add a legend that looks something like this:

Not at the moment unfortunately.

I’d recommend subscribing to for the latest development info.

So I managed to get the functionality by hacking the annotations. Basically, just place a text annotation where you want the group names in the legend. Only thing I had to do was to group the different traces and then increase the tracegroupgap argument.

1 Like