Hello, I would like to plot my data in a fashion similar to a boxplot, but plot the true data points without a box, just overlay lines of the summary generated by the boxplot. I have less than 10 observations within each group, so I think showing the actual data would be more effective than the box of the boxplot. I have been unable to find a way to do this. Here is example data:> d168tenid168dh10i d168hb10i d168icc10i d168rcs10i d168t410i d168tb410i 1 72 52 29 80 39 68 2 76 47 28 68 49 21 3 123 85 87 71 164 137 4 58 47 50 70 18 1> boxplot(d168teni)works to describe the data (each column a column in the plot). However, instead of the boxes, I want the data plotted (in a column) with the 5 summary lines drawn over the points. I have tried using functions from Design and have been unable to find a solution. I think I am missing the point. Any suggestions on where to look or how to approach this differently? thanks, aric
Try this: boxplot(Sepal.Length ~ Species, iris) with(iris, stripchart(Sepal.Length ~ Species, vertical = TRUE, add = TRUE)) On 9/27/05, Aric Gregson <aorchid at mac.com> wrote:> Hello, > > I would like to plot my data in a fashion similar to a boxplot, but > plot the true data points without a box, just overlay lines of the > summary generated by the boxplot. I have less than 10 observations > within each group, so I think showing the actual data would be more > effective than the box of the boxplot. I have been unable to find a way > to do this. > > Here is example data: > > d168teni > d168dh10i d168hb10i d168icc10i d168rcs10i d168t410i d168tb410i > 1 72 52 29 80 39 68 > 2 76 47 28 68 49 21 > 3 123 85 87 71 164 137 > 4 58 47 50 70 18 1 > > > boxplot(d168teni) > > works to describe the data (each column a column in the plot). However, > instead of the boxes, I want the data plotted (in a column) with the 5 > summary lines drawn over the points. > > I have tried using functions from Design and have been unable to find a > solution. I think I am missing the point. > > Any suggestions on where to look or how to approach this differently? > > thanks, > > aric > > ______________________________________________ > 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 >
--On 9/27/05 8:55 PM -0400 Gabor Grothendieck sent:> Try this: > > boxplot(Sepal.Length ~ Species, iris) > with(iris, stripchart(Sepal.Length ~ Species, vertical = TRUE, add > TRUE))Thanks very much for the hint. I did something very similar with decent results. The only problem I am having now is that I cannot figure out how to make stripchart plot without a box or axis. Alternatively, I can use DOTplot from UsingR, but I cannot find out how to rotate it for vertical. thanks, aric> On 9/27/05, Aric Gregson <aorchid at mac.com> wrote: >> Hello, >> >> I would like to plot my data in a fashion similar to a boxplot, but >> plot the true data points without a box, just overlay lines of the >> summary generated by the boxplot.
Hi Aric Gregson wrote:> --On 9/27/05 8:55 PM -0400 Gabor Grothendieck sent: > > >>Try this: >> >>boxplot(Sepal.Length ~ Species, iris) >>with(iris, stripchart(Sepal.Length ~ Species, vertical = TRUE, add >>TRUE)) > > > Thanks very much for the hint. I did something very similar with decent > results. The only problem I am having now is that I cannot figure out > how to make stripchart plot without a box or axis. Alternatively, I can > use DOTplot from UsingR, but I cannot find out how to rotate it for > vertical.You might also like to take a look at Figure 3.27 (and associated R code) on http://www.stat.auckland.ac.nz/~paul/RGraphics/chapter3.html Paul>>On 9/27/05, Aric Gregson <aorchid at mac.com> wrote: >> >>>Hello, >>> >>>I would like to plot my data in a fashion similar to a boxplot, but >>>plot the true data points without a box, just overlay lines of the >>>summary generated by the boxplot. >> > > ______________________________________________ > 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-- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/
Is this any better? For more along these lines, check out ?bxp for numerous options which are accepted by boxplot, not just bxp: boxplot(Sepal.Length ~ Species, iris, boxcol = 1, medcol = 2, whiskcol = 0, staplecol = 4, outcol = 0, boxfill = "wheat", boxlty = 0) with(iris, stripchart(Sepal.Length ~ Species, vertical = TRUE, add = TRUE)) On 9/28/05, Aric Gregson <aorchid at mac.com> wrote:> --On 9/27/05 8:55 PM -0400 Gabor Grothendieck sent: > > > Try this: > > > > boxplot(Sepal.Length ~ Species, iris) > > with(iris, stripchart(Sepal.Length ~ Species, vertical = TRUE, add > > TRUE)) > > Thanks very much for the hint. I did something very similar with decent > results. The only problem I am having now is that I cannot figure out > how to make stripchart plot without a box or axis. Alternatively, I can > use DOTplot from UsingR, but I cannot find out how to rotate it for > vertical. > > thanks, > > aric > > > On 9/27/05, Aric Gregson <aorchid at mac.com> wrote: > >> Hello, > >> > >> I would like to plot my data in a fashion similar to a boxplot, but > >> plot the true data points without a box, just overlay lines of the > >> summary generated by the boxplot. > > > > >
Paul Murrell a ??crit :> You might also like to take a look at Figure 3.27 > (and associated R code) on > http://www.stat.auckland.ac.nz/~paul/RGraphics/chapter3.htmlThank you very much for making this page available. The power of R graphics, and the number of options, makes such examples very useful. (At least for beginners like me !) Thanks.
>>>>> "vincent" == vincent <vincent at 7d4.com> >>>>> on Thu, 29 Sep 2005 08:30:10 +0200 writes:vincent> Paul Murrell a ??crit : >> You might also like to take a look at Figure 3.27 (and >> associated R code) on >> http://www.stat.auckland.ac.nz/~paul/RGraphics/chapter3.html vincent> Thank you very much for making this page available. vincent> The power of R graphics, and the number of options, vincent> makes such examples very useful. (At least for vincent> beginners like me !) Thanks. To really thank Paul, you should buy the book to which the above web page refers : http://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html A very nice and useful book to have, indeed! Martin Maechler, ETH Zurich
Aric Gregson wrote:> Hello, > > I would like to plot my data in a fashion similar to a boxplot, but > plot the true data points without a box, just overlay lines of the > summary generated by the boxplot. I have less than 10 observations > within each group, so I think showing the actual data would be more > effective than the box of the boxplot. I have been unable to find a way > to do this. > > Here is example data: > >>d168teni > > d168dh10i d168hb10i d168icc10i d168rcs10i d168t410i d168tb410i > 1 72 52 29 80 39 68 > 2 76 47 28 68 49 21 > 3 123 85 87 71 164 137 > 4 58 47 50 70 18 1 > > >>boxplot(d168teni) > > > works to describe the data (each column a column in the plot). However, > instead of the boxes, I want the data plotted (in a column) with the 5 > summary lines drawn over the points. > > I have tried using functions from Design and have been unable to find a > solution. I think I am missing the point. > > Any suggestions on where to look or how to approach this differently? >I haven't seen anything like this posted, so I'll take a punt. noboxplot<-function(x,plot=FALSE,...) { boxplot.info<-boxplot(x,plot,...) dimx<-dim(x) if(is.null(dimx)) plot(1,x) else { xpts<-1:dimx[2] # you may want to use text() here if you want the # actual values displayed matplot(t(as.matrix(x)),axes=FALSE,xlim=c(0.5,dimx[2]+0.5), ylab=deparse(substitute(x))) } box() axis(2) nbp.labels<-names(x) if(is.null(nbp.labels)) nbp.labels<-as.character(xpts) axis(1,at=xpts,labels=nbp.labels) for(xpos in 1:dimx[2]) { segments(xpos-0.2,boxplot.info$stats[,xpos], xpos+0.2,boxplot.info$stats[,xpos], lwd=c(1,1,3,1,1)) } return(boxplot.info) } Hope it's what you want. Jim