r语言 - 在 ggplot2 中组合函数



我的目标是在 ggplot2 中绘制一个带有 s 曲线的二次函数,如图所示 这里

这就是我到目前为止得到的,但线条没有排成一排!我的观点是它与seq(0,2(有关。非常感谢您的评论!

     ggplot(data.frame(x = seq(0, 2)), aes(x)) + 
stat_function(fun=function(x)x^2, geom="line")
      stat_function(fun = function(x) 1/(1 + exp(-x)), geom = "line")
ggplot(data.frame(x = seq(0, 2)), aes(x)) + 
  stat_function(fun=function(x)x^2, geom="line") +
  stat_function(fun = function(x) 1/(1 + exp(-x)), geom = "line")

我想你忘记了加号。它对我有用。

最新更新