-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior
Milestone
Description
When I try to create a stacked area chart using the following code the segments don't stack, and they occlude each other instead.
library("ggplot2")
library("dplyr")
## Create data
set.seed(40)
dat <- data.frame(x = rep(c(1:10), 3),
var = rep(c("a", "b", "c"), 10),
y = round(runif(30, 1, 5)))
## Plot
ggplot(dat, aes(x = x, y = y, fill = var)) +
geom_area(position = "stack")However if I reorder the rows so all of the var values are grouped together, it does create a stacked chart:
dat %>%
arrange(var, x) %>%
ggplot(aes(x = x, y = y, fill = var)) +
geom_area(position = "stack")Is this a bug, or is the ordering of the rows meant to matter like this?
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior

