I'm fairly new to R and have managed to make a grouped bar plot using ggplot2. I want to try and reorder the plot so that the plot is ordered by 'homepercent' in decreasing order.
This is the data:
team homepercent awaypercent
1 Adelaide 85 50
2 Brisbane 18 8
3 Carlton 38 17
etc...
This is the code which does produce a grouped barplot, just in the order of team name.
winpercent <- read.csv("winpercent.csv")
winpercent.m <- melt(winpercent, id.vars='team')
ggplot(winpercent.m, aes(team, value))
+geom_bar(aes(fill=variable), width=0.4, position=position_dodge(width=0.5), stat="identity")
+theme(legend.position = 'top', legend.title=element_blank(), axis.title.x=element_blank(), axis.title.y=element_blank())
Any answers would be greatly appreciated!