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, Aug 25, 2008 at 12:56 PM, Raj Minhas <[EMAIL PROTECTED]> wrote: > > 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="boxplot") > > I want to know how I can modify this command so that the categories are > plotted in a different order (say, J, D, E, I, H, F, G). > > Thanks in advance. > > -Raj. > -- > View this message in context: > http://www.nabble.com/ggplot-boxplot---how-to-order-categories-tp19147920p19147920.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- http://had.co.nz/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.