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, ...)
感謝您的幫助 問候 帕斯卡爾