I'm trying to do a plot with ggplot2
and geom_area
. The fill is set by a variable. For some reason, only the 'outer' groups are filled. I can't figure out how to get the inner regions filled as well.
The same problem seems to occur here but no answer is given on how to solve it.
Below is an minimal example of the code i'm using and the resulting plot:
I'm using R 3.3 and ggplot2_2.1.0
Any help would be appreciated.
df <- data.frame(month = seq(from = as.Date("2016-01-01"), to = as.Date("2016-12-31"), by = "month"),
type = c(rep("past", times = 5), "current", rep("future", times = 6)),
amount = c(seq(from = 100, to = 1200, by = 100)))
df$type <- factor(df$type, levels = c("past", "current", "future"))
ggplot(data = df, aes(x = month, y = amount, fill = type)) +
geom_area()