Skip to content

Instantly share code, notes, and snippets.

@blackfist
Created July 13, 2014 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blackfist/40d608a3d39c4e24c6dc to your computer and use it in GitHub Desktop.
Save blackfist/40d608a3d39c4e24c6dc to your computer and use it in GitHub Desktop.
I'd like to know why this bar chart isn't sorted even though the data frame that I sent to it is.
library(ggplot2)
library(plyr)
library(verisr)
load("~/Documents/vzdata/verisr_object/verisr2.dat")
patterns <- as.data.frame(table(vz$pattern))
names(patterns) <- c("Pattern", "Count")
patterns <- arrange(patterns, desc(Count))
print(patterns)
ggplot(patterns, aes(x=Pattern, y=Count)) + geom_bar(stat="identity") + coord_flip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment