R包ggpmisc可用于显示lm模型和poly模型的方程ggplot2(参见此处参考).想知道如何使用nls模型方程结果.以下是我的MWE.ggplot2ggmisc
library(ggpmisc)
args <- list(formula = y ~ k * e ^ x,
start = list(k = 1, e = 2))
ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
stat_fit_augment(method = "nls",
method.args = args)
Run Code Online (Sandbox Code Playgroud) 我是R的新手,使用ggplot2绘制指数曲线时遇到一些困难。我下面有一组数据。
数据
X Y x y
1 0.6168111 37.20637 0.6168111 37.20637
2 0.5478698 24.17084 0.5478698 24.17084
3 0.6082697 26.21261 0.6082697 26.21261
4 0.6094899 26.14065 0.6094899 26.14065
5 0.6095040 38.56314 0.6095040 38.56314
6 0.6933108 36.78443 0.6933108 36.78443
7 0.5796637 27.82840 0.5796637 27.82840
8 0.4716866 30.63080 0.4716866 30.63080
9 0.5291792 29.78255 0.5291792 29.78255
10 1.2520000 33.12657 1.2520000 33.12657
11 1.2260000 31.81066 1.2260000 31.81066
12 1.2690000 59.91388 1.2690000 59.91388
13 1.2060000 49.92380 1.2060000 49.92380
14 1.0760000 29.67524 1.0760000 29.67524
15 0.9750000 27.43602 0.9750000 …Run Code Online (Sandbox Code Playgroud)