How can I change the order of aestetics layers? Here\'s and example
dat <- tibble (acc = rep(c(0,1), 200),
rt = rnorm(400, 0.5, 0.1))
dat
Ok, I just wanted to add an answer concerning the brewer palettes, which is more straightforward.
So, original data:
dat <- tibble (acc = rep(c(0,1), 200),
rt = rnorm(400, 0.5, 0.1))
dat %>% ggplot(aes(x = rt, fill = factor(acc))) +
geom_density(aes(y= ..count..*0.03), alpha = 0.6)+
scale_fill_brewer(palette = "Set1")
Switch colors
dat %>% ggplot(aes(x = rt, fill = factor(acc))) +
geom_density(aes(y= ..count..*0.03), alpha = 0.6)+
scale_fill_brewer(palette = "Set1", direction = -1)
Switch position
dat %>% ggplot(aes(x = rt, fill = factor(acc, levels = c(1,0)))) +
geom_density(aes(y= ..count..*0.03), alpha = 0.6)+
scale_fill_brewer(palette = "Set1", direction = -1)
Switch position and color
dat %>% ggplot(aes(x = rt, fill = factor(acc, levels = c(1,0)))) +
geom_density(aes(y= ..count..*0.03), alpha = 0.6)+
scale_fill_brewer(palette = "Set1")