0

I made a grouped bar chart but I want the groups organized from lowest value for a variable to highest value.

The dataframe "habitat" consists of columns of "ï..Species", "RCP85Habitat", and "RCP26Habitat" Here's my code:

habitat.m <- melt(habitat, id.vars='ï..Species')

plot.habitat<-ggplot(habitat.m, aes(ï..Species, value)) +   
geom_bar(aes(fill = variable), position = "dodge", stat="identity")

A grouped barplot but values are not in order

Any suggestions on how I get species to be displayed from lowest value of variable RCP85 to the highest value?

r2evans
  • 141,215
  • 6
  • 77
  • 149
Amanda
  • 1
  • 1
  • https://stackoverflow.com/help/minimal-reproducible-example – Scransom May 13 '20 at 00:34
  • 1
    Does this answer your question? [Order Bars in ggplot2 bar graph](https://stackoverflow.com/questions/5208679/order-bars-in-ggplot2-bar-graph) – Scransom May 13 '20 at 00:35

0 Answers0