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 https://github.com/plotly/plotly.js/issues/689 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