![](/img/trans.png)
[英]Overlay 10 density plots in R with colour proportional to number of overlapping plots
[英]R - Overlay multiple least squares plots with colour coding
我正在尝试可视化一些看起来像这样的数据
line1 <- data.frame(x = c(4, 24), y = c(0, -0.42864), group = "group1")
line2 <- data.frame(x = c(4, 12 ,24), y = c(0, 2.04538, 3.4135), group = "group2")
line3 <- data.frame(x = c(4, 12, 24), y = c(0, 3.14633, 3.93718), group = "group3")
line4 <- data.frame(x = c(0, 3, 7, 12, 18), y = c(0, -0.50249, 0.11994, -0.68694, -0.98949), group = "group4")
line5 <- data.frame(x = c(0, 3, 7, 12, 18, 24), y = c(0, -0.55753, -0.66006, 0.43796, 1.38723, 3.17906), group = "group5")
df <- do.call(rbind, list(line1, line2, line3, line4, line5))
我要做的是 plot 同一 plot 上每个组的最小二乘线(和点)。 我希望线条和点的颜色与组相对应。
我所能做的就是 plot 根据他们的小组得分
ggplot(data = df, aes(x, y, colour = group)) + geom_point(aes(size = 10))
但我不知道如何添加线条并使它们的颜色与它们适合的点相对应。
我真的很感激这方面的任何帮助。 事实证明它比我想象的要困难得多。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.