Re: [R] sorting in barplot

From: Marc Schwartz <>
Date: Tue, 01 May 2007 12:49:17 -0500

On Tue, 2007-05-01 at 19:33 +0200, wrote:
> Hello,
> I'm trying to sort my bargraph.CI plot (function like barplot in the
> SCIPLOT package) by the mean of the response variable.
> Does somebody have a trick for it.
> Thank you.
> Romain Mayor, PHD student.

If it is built on top of barplot(), then by default, the factor levels of your response variable will determine the order of the bars in the plot.

See ?reorder.factor for more details relative to defining the order based upon the mean of the variable. There is an example there of using the median.

HTH, Marc Schwartz mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 01 May 2007 - 22:09:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 May 2007 - 16:31:05 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.