0

I have added a reproducible example for my previous question.

I'm trying to get a plot similar to this:

Stacked Area Plot

library(ggplot2)

Date <- as.numeric(rep(seq(2000:2005), each = 5))
value <- runif(30,0,100)
group <- rep(LETTERS[1:5],times = 6)
data <- data.frame(Date,value,group)

ggplot(data, aes(x = Date, y = value, fill = group)) + 
  geom_area()
Z.Lin
  • 28,055
  • 6
  • 54
  • 94

1 Answers1

1

Do I understand correctly that you want the areas to overlap instead of getting stacked?

Is this what you want?

ggplot(data, aes(x = Date, y = value, fill = group)) + 
  geom_area(position = "identity", alpha = 0.5)

enter image description here

AndreasM
  • 902
  • 5
  • 10