R 根据stat_smooth()中拟合的回归绘制点
我正在使用ggplot2软件包绘制一个图,其中包含四种不同的回归,它们安装在stat_smooth()上,如下所示:R 根据stat_smooth()中拟合的回归绘制点,r,ggplot2,R,Ggplot2,我正在使用ggplot2软件包绘制一个图,其中包含四种不同的回归,它们安装在stat_smooth()上,如下所示: ggplot(NULL, aes(x = time, y = shoot)) + stat_smooth(data = data.0.cr, method = "lm", formula = y ~ I(x), se = FALSE, linetype = "F1", color = "black") + stat_smooth(data = data.0.pr, metho
ggplot(NULL, aes(x = time, y = shoot)) +
stat_smooth(data = data.0.cr, method = "lm", formula = y ~ I(x), se = FALSE, linetype = "F1", color = "black") +
stat_smooth(data = data.0.pr, method = "lm", formula = y ~ I(x^2) + I(x^3), se = FALSE, linetype = "solid", color = "black") +
stat_smooth(data = data.35.cr, method = "lm", formula = y ~ I(x), se = FALSE, linetype = "dotted", color = "black") +
stat_smooth(data = data.35.pr, method = "lm", formula = y ~ I(x) + I(x^2) + I(x^3), se = FALSE, linetype = "12345678", color = "black")
其中一个data.frame如下所示(我为每个stat_smooth()指定了一个数据):
由于每个因子需要以不同的方式拟合,我编写了四个stat_smooth(),为了区分每个因子,我使用了四种不同的线型
我想包括沿每个回归曲线绘制的点。换句话说,我想定义这条线如下:
Reg1:实线和三角形Reg2:虚线和三角形
Reg3:实线和圆
Reg4:虚线和圆 可以这样做而不是定义不同类型的线型吗?(使用一些几何点()或类似物)
提前谢谢你 你的数据集在哪里?嗨@ycw,我编辑了我的文章,以包含我的一个数据集的示例
dose time genotype block shoot
0 0 cr 1 120.3168
0 0 cr 2 123.0590
0 0 cr 3 108.0160
0 1 cr 1 103.3750
0 1 cr 2 146.7620
0 1 cr 3 92.5630
0 4 cr 1 83.2540
0 4 cr 2 131.2680
0 4 cr 3 122.0290
0 7 cr 1 136.7460
0 7 cr 2 136.5300
0 7 cr 3 115.0080