I’m using Plotly to generate a map with a lines in three different colours:
I’d like to be able to use the legend to toggle each of the groups on and off, but when I add a legend, it shows all the individual traces, so I’d have to click dozens of times to achieve the desired effect.
Is there a way to group these traces so that the legend will just show (e.g.) “blue”, “green”, and “orange”, so that I can toggle them all at once?
Also, a separate question: is it possible to specify different size nodes (markers) at each end of an edge (line)? So far I have only been able to set one size.
Oh. You’ll need to add showlegend: false to all the traces you don’t want to show in the legend. In your case that would all but the first trace of each legendgroup value.
Now the grouping works (woohoo!), but the traces are all still visible in the legend. It could be my logic, though… would you mind double-checking to see what I’ve done wrong?