[R] boxplot group labels

Gabor Grothendieck ggrothendieck at gmail.com
Sun May 14 22:05:59 CEST 2006


Change the order of the levels in the factor:

with(play, boxplot(income~factor(code, levels = rev(levels(code))),
horizontal = TRUE, boxwex = 0.1))

On 5/14/06, Alexander Nervedi <alexnerdy at hotmail.com> wrote:
> Hi All,
>
> I would like to control the order in which my boxplots are drawn. When i
> issue the lines below I find that group "a" get plotted lowest, while the
> highest letter grade is plotted on the top. I want to plot the letter grades
> in descending order and I was wondering if tere is a quick way to do that.
>
> thanks.
> Alex.
>
>
> play <- data.frame(code = letters[round(runif(100)*10+1)], income =
> runif(100))
> with(play, boxplot(income~code, horizontal = TRUE, boxwex = 0.1))
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list