-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
featuresomething newsomething new
Description
If I want two traces on two sub-plots to share the same legend, I (think I) have to explicitly specify the trace color, like
import plotly.graph_objs as go
from plotly.offline import iplot, init_notebook_mode
init_notebook_mode()
style1 = dict(name='trace1', legendgroup='trace1', line=dict(color='red'))
style2 = dict(name='trace2', legendgroup='trace2', line=dict(color='blue'))
fig = go.Figure(
data=[dict(y=[1, 2, 3], **style1),
dict(y=[2, 1, 3], **style2),
dict(y=[1, 2, 3], showlegend=False, xaxis='x2', **style1),
dict(y=[1, 3, 2.5], showlegend=False, xaxis='x2', **style2)],
layout=dict(xaxis=dict(domain=[0, .45]),
xaxis2=dict(domain=[.55, 1]))
)
iplot(fig)One issue with the above is that I lose the default plotly colors (see plotly/plotly.py#1026 for getting them back).
Is there a more generic way to tell plotly that two traces should share the same legend/style, or even count as one? Thanks
binnisb, hlgirard, kacper-w, Maryom, davidruble and 13 more
Metadata
Metadata
Assignees
Labels
featuresomething newsomething new
