我想使用geom_函数而不是stat_summary在这里重写绘图。有什么建议?
感谢您的关注。
library(ggplot2)
ggplot(data = mpg)+
stat_summary(
mapping = aes(x = class, y = hwy),
fun.ymin = min,
fun.ymax = max,
fun.y = median
)
答案 0 :(得分:5)
ggplot(data = mpg)+
geom_pointrange(
mapping = aes(x = class, y = hwy),
fun.ymin = min, #passed to the stat via the ...
fun.ymax = max, #ditto
fun.y = median, #ditto
stat = "summary"
)