I have a very simple problem that I did not manage to solve. In the following legend, I would like to have "work" above "sleep" and keep the graph and colors unchanged (so work in blue and sleep in red).
data <- data.frame(Name = rep(c("Tom","Ana"), 2),
Category = rep(c("sleep","work"),each=2),
Percentage = c(40,20,60,80))
ggplot(data, aes(fill=Category, y=Percentage, x=Name)) +
geom_bar(position="fill", stat="identity", colour="black") +
coord_flip()
Thanks a lot in advance!!!
