Is there any difference between `geom_a(stat=“b”,

2019-06-20 04:19发布

I have seen both usages, yet I don't know the difference between 2 in practical.

And, why

stat_vline(xintercept="mean", geom="vline") # this works

But

geom_vline(xintercept="mean", stat="vline") # this doesn't work

Does that mean after passing mean to a next layer which is vline in this case, the function becomes character? Is this behaviour general?

标签: r ggplot2
1条回答
等我变得足够好
2楼-- · 2019-06-20 04:44

You might have found a bug. If you specify the aesthetics mapping (again) it works:

p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point()
p + geom_vline(aes(x=wt, y=mpg), xintercept="mean", stat="vline")

Typical for ggplot2 documentation is somewhat sparse, which makes it difficult to judge if this is intentional.

查看更多
登录 后发表回答