plot_ly(d, x =~x, y =~y, type ="scatter", mode ="markers")
typeとmodeを指定しないと、プロット自体はできるものの、警告が表示されます。
plot_ly(d, x =~x, y =~y)
No trace type specified:
Based on info supplied, a 'scatter' trace seems appropriate.
Read more about this trace type -> https://plotly.com/r/reference/#scatter
No scatter mode specifed:
Setting the mode to markers
Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode
type = scatterでOKです。 modeはlines, markers, lines+markers, lines+markers+text, noneのような感じで指定します。
p <-plot_ly(d, x =~x, y =~y, type ="scatter", mode ="markers")p <-add_trace(p, data = d, x =~x, y =~y2, type ="scatter", mode ="lines")p
最初にベースプロットを描き、そのあとに追加していくこともできます。
p <-plot_ly()p <-add_trace(p, data = d, x =~x, y =~y, type ="scatter", mode ="markers")p <-add_trace(p, data = d, x =~x, y =~y2, type ="scatter", mode ="lines")p