[R] Again, about boxplot

stephen sefick ssefick at gmail.com
Fri Sep 12 17:42:24 CEST 2008


?factor

On Fri, Sep 12, 2008 at 11:33 AM, Adaikalavan Ramasamy
<a.ramasamy at imperial.ac.uk> wrote:
> I just changed the 'at' argument and added an 'xlim' option.
>
>  boxplot(len ~ dose, data = ToothGrowth,
>          boxwex = 0.25, at = 1:3,
>          subset = which(supp == "VC"), col = "yellow",
>          main = "Guinea Pigs' Tooth Growth",
>          xlab = "Vitamin C dose mg",
>          ylab = "tooth length", xlim=c(1, 6), ylim=c(0, 35), yaxs="i")
>
>  abline(v=3.5)
>
>  boxplot(len ~ dose, data = ToothGrowth, add = TRUE,
>          boxwex = 0.25, at = 1:3 + 3,
>          subset = which(supp == "OJ"), col = "orange")
>
>  legend("bottomright", c("Ascorbic acid", "Orange juice"),
>         fill = c("yellow", "orange"))
>
> Regards, Adai
>
>
>
> cathelf wrote:
>>
>> Thank you for your guys reply for my previous question. But I got one more
>> question about the boxplot. With the code in the R-help:
>>
>> boxplot(len ~ dose, data = ToothGrowth,
>>        boxwex = 0.25, at = 1:3 - 0.2,
>>        subset = supp == "VC", col = "yellow",
>>        main = "Guinea Pigs' Tooth Growth",
>>        xlab = "Vitamin C dose mg",
>>        ylab = "tooth length", ylim = c(0, 35), yaxs = "i")
>> boxplot(len ~ dose, data = ToothGrowth, add = TRUE,
>>        boxwex = 0.25, at = 1:3 + 0.2,
>>        subset = supp == "OJ", col = "orange")
>> legend(2, 9, c("Ascorbic acid", "Orange juice"),
>>       fill = c("yellow", "orange"))
>>
>> I got 6 boxplots, which is ordered as "0.5, 0.5, 1, 1, 2, 2"
>> How can I reorder the 6 boxplots as "0.5, 1, 2,  0.5, 1, 2"?
>>
>> Thank you very much!
>
> ______________________________________________
> R-help at 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.
>



-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.

	-K. Mullis



More information about the R-help mailing list