-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Milestone
Description
I am using geom_area for stacked area chart showing cumulative results for categories.
For some series the cumulative result turns negative from time to time and this have been working nicely with versions of ggplot2 until 3.2.0 was released. Some things have been fixed with the 3.2.1 release but I experince an issue when I have more than one category and using the category for the fill. I notice an ealier issue #3390 with similar problem but that has been closed now or ?
packageVersion("ggplot2")
[1] ‘3.2.1’
# with one serie (category A) it works as I expect
date <- as.Date(c("2019-07-31","2019-08-01","2019-08-02","2019-08-03"))
category <-rep(c("A"),4)
variable <-rep(c("cum_result"),4)
value <- c(0,2,3,-4)
data<- data.frame(date,category,variable,value)
ggplot(data, aes(x=date,y=value)) +
geom_area(aes(x=date,y=value,fill=category),stat = "identity")
# addding a additional category B with values on the variable shows the issue
date <- as.Date(c("2019-07-31","2019-07-31","2019-08-01","2019-08-01","2019-08-02","2019-08-02","2019-08-03","2019-08-03"))
category <-rep(c("A","B"),4)
variable <-rep(c("cum_result"),8)
value <- c(0,0,
2,1,
3,6,
-4,3)
data<- data.frame(date,category,variable,value)
ggplot(data, aes(x=date,y=value)) +
geom_area(aes(x=date,y=value,fill=category),stat = "identity")
Metadata
Metadata
Assignees
Labels
No labels