Re: [R] ggplot2: ordering categorial data

2007-10-16 Thread hadley wickham
Hi Christoph, There's a couple of things you need to do. Firstly, you need to reorder the factor according to how you want the data sorted df$tld <- reorder_factor(df$tld, tapply(df$spam1, df$tld, mean)) is one way to do that. The reason that position dodge isn't working for you is because it

Re: [R] ggplot2: ordering categorial data

2007-10-15 Thread Christoph Krammer
I got some further with this issue by myself, using a temporary rank number to get the bars sortet: data_rb <- read.csv("c421_recipient_country.txt", header=TRUE, nrows=10) data_rb$i <- factor(seq(1,10)) levels(data_rb$i) <- data_rb$tld ggplot(data_rb) + geom_bar(aes(x=i, y=spam), colour="navy",