I am trying to plot two scatter subplots with plotly whereby the colour automatically chosen in the two sub-plots is the same, but I cannot find a way to do so.
Following is a code snippet:
import plotly as py
import plotly.tools as to
import numpy as np
import plotly.graph_objs as go
fig=to.make_subplots(rows=1,cols=2,subplot_titles=['Plot 1','Plot 2'])
X=[0,50,100,150,200,250,300,350,400,450,500]
Y=[1,2,3,4,5,6,7,8,9,10,11]
Z=Y.copy()
for i in np.arange(11):
if i==0:
Z[0]=Y[0]
else:
Z[i]=Y[i]+Z[i-1]
trace=go.Scatter(x=X,y=Y)
fig.append_trace(trace,1,1)
trace=go.Scatter(x=X,y=Z,showlegend=False)
fig.append_trace(trace,1,2);
py.offline.plot(fig)
The above code plots two subplots and the scatters will have a different colour. I want them to have the same colour. I am aware that I can hard-code the colour on the two scatters but I need the colours to be selected automatically from some colour scheme.
How can I achieve what I need?