1
我想使用geom_ribbon来模仿geom_area 的行为,但我不成功。你会有什么提示,为什么以下不起作用? 我从ggplot2 geom_area web pages使用了Hadley的声明: “区域图是geom_ribbon的特例,其中范围的最小值固定为0,位置调整默认为position_stacked。”堆叠geom_ribbon
test <- expand.grid(Param = LETTERS[1:3], x = 1:5)
test$y <- test$x
# Ok
p <- ggplot(test)
p <- p + geom_area(aes(x = x, y = y, group = Param, fill = Param), alpha = 0.3)
p
# not ok - initial idea
p <- ggplot(test)
p <- p + geom_ribbon(aes(x = x, ymin = 0, ymax = y, group = Param, fill = Param), alpha = 0.3, position = position_stack())
p
此外,我怎样才能看到编码的方式编码的方式geom_XXX? 我传统的方式给出了下面的,这是不是非常有用:
> geom_ribbon
function (mapping = NULL, data = NULL, stat = "identity", position = "identity",
na.rm = FALSE, ...)
GeomRibbon$new(mapping = mapping, data = data, stat = stat, position = position,
na.rm = na.rm, ...)
感谢您的帮助 问候 帕斯卡尔