3
Does anyone have any idea how the order of the factors in only 1 bar in ggplot2? Reordering the data no longer works :(
In case I would like to reverse the first bar, so that the green was up and the red was down.
library(ggplot2)
dados <- expand.grid(a = letters[1:5], b = letters[1:2])
dados$a <- paste(dados$a)
dados$b <- paste(dados$b)
dados$val <- rnorm(10, 5, 1)
ggplot(aes(x = a, y = val, fill = b), data = dados) + geom_bar(stat = 'identity')
dados2 <- rbind(tail(dados, -1), head(dados, 1))
ggplot(aes(x = a, y = val, fill = b), data = dados2) + geom_bar(stat = 'identity') # Funcionava nas versões anteriores :\
Only on the first bar?
– Daniel Ikenaga
@Daniel yes, only on the first bar
– Rcoster
It will probably have to be a separate geom_bar, which comes from a separate dataset
– Guilherme Marthe