vyuf76gyghbh
vyuf76gyghbh

Reputation: 1

Stacked Area Plot Y-axis not reflecting actual data points: with reproducible example

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()

Upvotes: 0

Views: 38

Answers (1)

AndreasM
AndreasM

Reputation: 942

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

Upvotes: 1

Related Questions