我见过这两种用法,但我不知道实际中 2 之间的区别。
而且,为什么
stat_vline(xintercept="mean", geom="vline") # this works
但
geom_vline(xintercept="mean", stat="vline") # this doesn't work
这是否意味着通过后
mean
到下一层 vline
在这种情况下,函数变成了字符?这种行为是普遍的吗?
最佳答案
您可能发现了一个错误。如果您指定美学映射(再次),它会起作用:
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point()
p + geom_vline(aes(x=wt, y=mpg), xintercept="mean", stat="vline")
典型用于
ggplot2
文档有点稀少,这使得很难判断这是否是故意的。
关于r - `geom_a(stat="b", ... )` and ` stat_b(geom ="a",...)`之间有什么区别吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18786161/