I can get a "filled" geom_line
with either geom_ribbon
or geom_area
. Is there an equivalent for geom_step
that doesn't require messing with polygons/barplots or creating the actual step points? Here is some sample data:
library(ggplot2)
set.seed(1)
df <- data.frame(
x=rep(sort(sample(1:20, 5)), 3),
y=ave(runif(15), rep(1:3, each=5), FUN=cumsum),
grp=letters[rep(1:3, each=5)]
)
ggplot(df, aes(x=x, y=y, color=grp)) + geom_step(position="stack")
Which produces:
Basically, I want exactly the same thing, but with filled areas. I know how to do this by actually creating the x/y values required for the steps and using geom_area
, but I'm hoping there is something simpler.