Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Horizontal bar graphs: Match default stack order in legend as well #1837
According to the v2.2.0 announcement: "position_stack() and position_fill() now stack values in the reverse order of the grouping, which makes the default stack order match the legend." IMHO this should also be true for horizontal bar graphs.
df <- data.frame( x = factor(c(1, 1, 2, 2)), y = c(1, 3, 2, 1), grp = c("a", "b", "a", "b") ) ggplot(data = df, aes((x), y, fill = (grp), label = y)) + geom_col() + geom_text(position = "stack_point") + theme(legend.position = "bottom") + coord_flip()
Come to think of it the natural thing would be to have a switch in