R + Plot.ly + add_trace

时间:2018-07-31 01:26:36

标签: r plotly r-plotly

我正在尝试在折线图中添加第二个Y轴?

plot_ly(C,x =~Ymd,y=~Spots,mode="lines")   # This works.
plot_ly(C,x =~Ymd,y=~ma90,mode="lines")   # This works.
p<- plot_ly(C,x =~Ymd,y=~Spots,mode="lines")%>%   # This doesn't work
add_trace(p,y=~ma90,mode="lines")

1 个答案:

答案 0 :(得分:0)

您需要在跟踪中指定public struct ComboItem { public string Question { get; set; } public int ID { get; set; } } using (var Context = new ProfetusModel()) { var GetQuestions = Context.Questions.Select(ques => new ComboItem { Question = ques.Question1, ID = ques.IdQues }).ToList(); CompoQues.ItemsSource = GetQuestions CompoQues.DisplayMemberPath = "Question"; CompoQues.SelectedValuePath = "ID"; CompoQues.SelectedIndex = 0; }

yaxis = <new yaxis name>

enter image description here