-1

I have a plot that I'm creating using the following code:

p <- ggplot(flexbooks, aes(x=SchoolYear, y=Count,fill=Type)) + geom_bar(stat="identity") +
  geom_text(data=flexbooks,aes(label=Count),vjust=-1,hjust=0.5)
p

I get the following plot:

enter image description here

I would like to flip the numbers here. The ones shown on top have to be at the bottom and vice-versa.

Any help would be appreciated. Thanks.

Patthebug
  • 4,647
  • 11
  • 50
  • 91
  • 3
    Your question does not contain a [reproducible example](http://stackoverflow.com/q/5963269/4303162). It is therefore hard to understand your problem and give you an appropriate answer. Please make your data available (e.g. by using `dput()`) or use one of the example data sets in R. Also, add the minimal code required to reproduce your problem to your post. – Stibu Mar 11 '16 at 21:20

1 Answers1

0

Try reversing the legend:

p <- ggplot(flexbooks, aes(x=SchoolYear, y=Count,fill=Type)) +  
     geom_bar(stat="identity") +
     geom_text(data=flexbooks,aes(label=Count),vjust=-1,hjust=0.5) +
     guides(fill = guide_legend(reverse = TRUE))
HubertL
  • 19,246
  • 3
  • 32
  • 51