I can get a \"filled\" geom_line with either geom_ribbon or geom_area. Is there an equivalent for geom_step that doesn\'
Here is the answer I was thinking of, for reference, but I'm hoping for something simpler/built-in if possible:
df2 <- rbind(
df,
transform(df[order(df$x),],
x=x - 1e-9, # required to avoid crazy steps
y=ave(y, grp, FUN=function(z) c(z[[1]], head(z, -1L)))
) )
ggplot(df2, aes(x=x, y=y, fill=grp)) + geom_area()
