From: Marc Schwartz <MSchwartz_at_mn.rr.com>

Date: Sat 28 May 2005 - 01:10:58 EST

R-help@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 Received on Sat May 28 01:34:23 2005

Date: Sat 28 May 2005 - 01:10:58 EST

On Fri, 2005-05-27 at 10:17 -0400, BJ wrote:

> I am trying to construct a graph of 6 box plots of blood pressures. I

*> want them to be on a single set of axis and I want the SBP to be ontop
**> of the DBP. I have an array bp with the data in it and I tried
**>
**> a[1,]<-c(145,60,147,62,140,57)
**> a[2,]<-c(160,75,160,74,160,70)
**> a[3,]<-c(140,55,140,65,142,55)
**> boxplot(data.frame(a), main = "Blood Pressures", at=c(1,1,2,2,3,3),
**> names=c("sit","","lie","","stand",""))
**>
**> which is close to what I want, but it gives me a bunch of empty space at
**> the end. is there a better way to do this to avoid this?
**>
**> As always, Thank You. ~Erithid
*

To answer both of your posts, use the following:

# Review how your data is structured above. Your code for creating "a" # is not replicable. For those lacking clinical insight, explaining # your acronyms would also be helpful... :-) SBP <- matrix(c(145, 160, 140, 147, 160, 140, 140, 160, 142), ncol = 3) DBP <- matrix(c(60, 75, 55, 62, 74, 65, 57, 70, 55), ncol = 3)

colnames(SBP) <- colnames(DBP) <- c("sit","lie","stand")

# The key here is to only plot three at a time, lest boxplot() # default to a 'xlim' of 0.5 to 6.5 (1:# of groups +/- 0.5) # Then use 'add = TRUE' to plot the second group of 3 # Note also that I set the 'ylim' to the range of the combined # values in the first plot. boxplot(data.frame(SBP), main = "Blood Pressures", ylim = range(c(SBP, DBP)), whisklty = 0, staplelty = 0)

boxplot(data.frame(DBP), add = TRUE, whisklty = 0, staplelty = 0)

Note the final two arguments, which result in the whiskers being drawn with an "invisible" line.

See ?boxplot and ?bxp for more information.

**HTH,
**
Marc Schwartz

R-help@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 Received on Sat May 28 01:34:23 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:32:13 EST
*