Re: [R] ggplot boxplot - how to order categories

2008-08-25 Thread Raj Minhas
Hadley, Many thanks - I have just started using ggplot and it is an amazing package. -Raj. -- View this message in context: http://www.nabble.com/ggplot-boxplot---how-to-order-categories-tp19147920p19148953.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] ggplot boxplot - how to order categories

2008-08-25 Thread hadley wickham
Hi Raj, It's the same as the other plotting systems in R: you need to change the order of the underlying factor levels. e.g.: levels(diamonds$color) <- c("J", "D", "E", "I", "H", "F", "G") If you're reordering then according to the value of another variable, also see ?reorder Hadley On Mon, A

[R] ggplot boxplot - how to order categories

2008-08-25 Thread Raj Minhas
I am interested in creating a boxplot using ggplot or qplot where I can specify the order of the categories being plotted on the x-axis. For example, the following command plots the categories (diamond color) in alphabetic order (D, E, ..., J): qplot(color, price/carat, data=diamonds, geom="boxpl