i trying reorder bar_plot highest lowest value. wrong code?
head(summary.m) var1 var2 value 2 u-a length 1155 3 u-aa length 422 4 u-aaa length 119 5 u-aac length 6 6 u-aag length 19 7 u-aat length 49 ggplot(summary.m, aes(x=reorder(var1,-value),y=value)) + geom_bar(stat="identity") + theme_bw(base_size=8) + theme(axis.text.x = element_text(colour = "black",angle=90 ))
you need specify function used in reorder. try this
ggplot(summary.m, aes(x=reorder(var1,value, fun=sum),y=value)) + geom_bar(stat="identity") + theme_bw(base_size=8) + theme(axis.text.x = element_text(colour = "black",angle=90 )) note : code works fine me, have inverted order.
Comments
Post a Comment