Closed
Description
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()
position = "stack_point"
borrowed from #1821.