I am running the following code in a for loop of range 0 to 3, in each iteration the data set tag_data
changes
Now the problem I am facing is the plots are not separated by color, I am getting two plots with a same color each time as shown in the figure below.
What changes should I make to plot each with different colors?
median_val=float('%.3f'%(median_val))
mean_val=float('%.3f'%(mean_val))
fig.add_trace(go.Scatter( x=tag_data.tag_datetime,y=tag_data.tag_value,name='TAG_{0}'.format(tag),
mode='lines+markers'),row=1,col=col_location)
fig.add_trace(go.Scatter( x=[tag_data.tag_datetime.min(),tag_data.tag_datetime.max()],y=[median_val,median_val],
mode='lines',line=dict(dash='dash',color='red',width=1.5), showlegend=False),row=1,col=col_location)
fig.add_trace(go.Scatter( x=[tag_data.tag_datetime.min(),tag_data.tag_datetime.max()],y=[mean_val,mean_val],
mode='lines',line=dict(dash='dash',color='gray',width=1.5), showlegend=False),row=1,col=col_location)
if median_val >= mean_val:
fig.add_trace(go.Scatter( x=[tag_data.tag_datetime.min(),tag_data.tag_datetime.max()],y=[median_val,median_val],
mode='text', showlegend=False,text='Median: {0}'.format(median_val), textposition='top left'),row=1,col=col_location)
fig.add_trace(go.Scatter( x=[tag_data.tag_datetime.min(),tag_data.tag_datetime.max()],y=[mean_val,mean_val],
mode='text', showlegend=False,text='Mean: {0}'.format(mean_val), textposition='bottom right'),row=1,col=col_location)
else:
fig.add_trace(go.Scatter( x=[tag_data.tag_datetime.min(),tag_data.tag_datetime.max()],y=[median_val,median_val],
mode='text', showlegend=False,text='Median: {0}'.format(median_val), textposition='bottom left'),row=1,col=col_location)
fig.add_trace(go.Scatter( x=[tag_data.tag_datetime.min(),tag_data.tag_datetime.max()],y=[mean_val,mean_val],
mode='text', showlegend=False,text='Mean: {0}'.format(mean_val), textposition='top right'),row=1,col=col_location)
col_location=col_location+1`