0
说我有这样的功能:GGPLOT2 - 在函数图变化线宽
quad <- function(x)
{
return (x^2)
}
那我绘制使用ggplot
:
plot <- ggplot(data.frame(x=c(0,4)), aes(x = x)) +
stat_function(fun = quad)
到目前为止,一切都很好,但该行是真的瘦了。因此,我添加一些特定的几何形状的线:
plot + geom_line(size=2)
但它返回此错误:
Error: geom_line requires the following missing aesthetics: y
如何操作线几何在这种类型的图表?
您需要'stat_function(fun = quad,size = 2)'。 –