hello everyone
I use plotly to make line_plot.
with code below:
p4=plot_ly(p4_data,x=~date,y=~Projection_Variance,type="scatter",mode ="lines",colors="blue",name = "a line",legendgroup ="d=f")%>%
add_trace(y=~Realized_yield,line = list(color = 'Chocolate', width = 2),name="b line",legendgroup ="g")
p4=p4%>%layout(legend = list(orientation = 'h'),xaxis =list(title = ""),colorway=c("blue","Chocolate"))
The color setting with "colors" works fine.
But when I add this plot with some other plot together.the color setting fialed.
subplot(p1,p2,p3,p4,nrows=2,margin = 0.05)
the p1 p2 p3 are similar plot with code like this
p1=plot_ly(p1_data,x=~date,y=~Projection_yield,type="scatter",mode ="lines",name = "Projection",line = list(color = 'blue'),legendgroup ="a")%>%
add_trace(y=~AB20_yield,line = list(color = 'red', width = 2, dash = 'dash'),name="AB20",legendgroup ="b")%>%
add_trace(y=~Good_Target,line = list(color = 'Orange', width = 2, dash = 'dash'),name="Good Target",legendgroup ="c")%>%
add_trace(y=~Exciting_Target,line = list(color = 'Lime', width = 2, dash = 'dash'),name="Exciting Target",legendgroup ="d")%>%
add_bars(y=~Realized_yield, marker = list(color = 'Chocolate'),legendgroup ="e",name="Realized")
p1=p1%>%layout(legend = list(orientation = 'h'),xaxis =list(title = ""),
yaxis =list(range=c(min(as.numeric(p1_data[p1_data!=0]),na.rm = T)*0.8,max(p1_data[,2:6])*1.02)))
I don't know what's going on.
Can any one help me with it?