![](/img/trans.png)
[英]How do I add multiple traces/trendlines each with a subset of data onto a single scatterplot in R using plotly
[英]Plotly - how to add multiple regressions for each color using R?
我的情節是將所有回歸線堆疊在一起。
mod = lm(weight_kg ~ height_cm, data=rugby_data)
fig2 <- plot_ly(rugby_data, x = ~height_cm, y = ~weight_kg, type="scatter", mode="markers", color = rugby_data$continent) %>%
add_lines(x = rugby_data$height_cm,y = fitted(mod), name="fitted", mode = "lines") %>%
layout(title = 'Height Vs. Weight Scatter Plot', plot_bgcolor = "#e5ecf6")
fig2
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.