Shared legend for subplots in Plotly

PeX
Wed, 21 Feb 2024 04:58:12 +0000
Visualization

I’ve seen variations of this question, but nothing fits my case exactly so I’m trying.:
I want to create three subplots in Plotly that share the same legend, I use the following code:

p = [p_1; p_2; p_3]
relayout!(p, height=500, width=900, title_text="Multiple Subplots")
p

Where each plot is a bar plot. Is there a way to create all the subplots with the same color scheme and share the same legend?

Thank you!

1 post - 1 participant