First of all, I thanks you all for replying me .
I've not asked my question in good terms, so I've made a little drawing
of what I want to do in my boxplot : - )
| - -
| | |
| ---- ----
| | | | |
| | 2 | | 2 |
| ---- ----
| | |
| - -
|
|
| - -
| | |
| ---- ----
| | | | |
| | 1 | | 1 |
| ---- ----
| | |
| - -
|
____________________________________________________________________
Test X Test Y
(I don't want my boxes to be shifted for the same Test value because I
know that boxplot 1 and 2 don't overlap)
I'm not sure that the boxplot function can do that.
But perhaps someone know a trick to help me.
Thanks
Christine
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Christine Serres <serres at valigene.com> writes:> First of all, I thanks you all for replying me . > I've not asked my question in good terms, so I've made a little drawing > of what I want to do in my boxplot : - )Mmm. That didn't come out too well on my end, but I think I know where you're heading.> (I don't want my boxes to be shifted for the same Test value because I > know that boxplot 1 and 2 don't overlap) > I'm not sure that the boxplot function can do that. > But perhaps someone know a trick to help me.I don't think there's a "standard" way to do that. It would look horrible if the boxes did overlap... One useful trick to know is that you can overlay several plots like this: plot(1:5) par(new=T) plot(1:6) Now that looks awful of course, but if you ensure that the axes are the same, then it can be turned into something useful. So how about playing with xlim, ylim &c ? -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I see what you mean now. You are lucky I did this kind of plot in one of my
previous assignment. I have modified the data to suit your needs. The data is
directly quoted from the paper 475.340 Designs of Surveys and Experiments in the
University of Auckland, New Zealand.
# Enter the data, count.
count <- c( 11, 14, 15, 17, 18, 21, 25,
39, 43, 46, 50, 52, 61, 67,
88, 92, 104, 113, 119, 120, 130,
222, 251, 259, 283, 299, 312, 337,
562,,604, 689, 702, 710, 739, 786 )
# Enter the ordered factor, Test.
# Since the data, count, is kind of like a 7 by 5 matrix, you need to
# repeat Test 1 ~ Test 5 by that amount.
# In other words, "Test" will look something like:
# 1 1 1 1 1 1 1
# 2 2 2 2 2 2 2
# 3 3 3 3 3 3 3
# 4 4 4 4 4 4 4
# 5 5 5 5 5 5 5
Test <- ordered( factor( rep( c( 1, 2, 3, 4, 5 ),
rep( 7, 5 )
)
)
)
# To draw a boxplot that has Test 1 ~ Test 5 on its x-axis and
# count on its y-axis.
# There should be 5 box&whiskers within the SAME plot box.
boxplot( split( count, Test ),
xlab = "Test", ylab = "counts",
main = "A Boxplot" )
To make is easier for you, I have even saved it as an R source file and attached
it
below for you. Just saved it to your disk, use "source()" function in
R to source
it in directly. From the R commands, it should be pretty easy to see how you
should change it to get the plot that you want. (The # means R comments, it
will
NOT affect the plots).
Cheers,
Ko-Kang Wang
Christine Serres wrote:
> First of all, I thanks you all for replying me .
> I've not asked my question in good terms, so I've made a little
drawing
> of what I want to do in my boxplot : - )
>
> | - -
> | | |
> | ---- ----
> | | | | |
> | | 2 | | 2 |
> | ---- ----
> | | |
> | - -
> |
> |
> | - -
> | | |
> | ---- ----
> | | | | |
> | | 1 | | 1 |
> | ---- ----
> | | |
> | - -
> |
> ____________________________________________________________________
>
> Test X Test Y
>
> (I don't want my boxes to be shifted for the same Test value because
I
> know that boxplot 1 and 2 don't overlap)
> I'm not sure that the boxplot function can do that.
> But perhaps someone know a trick to help me.
>
> Thanks
> Christine
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
https://stat.ethz.ch/pipermail/r-help/attachments/20000408/7bb6a802/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: boxplot.R
Type: application/x-unknown-content-type-r_auto_file
Size: 898 bytes
Desc: not available
Url :
https://stat.ethz.ch/pipermail/r-help/attachments/20000408/7bb6a802/boxplot.bin