Here is a question from an old guy: I want to use the boxplot function as follows: boxplot( p.prop ~ R + bins ) This command makes nice boxplot for the factor "R" crossed with the factor "bins". I am having alot of trouble getting control of the labels on the X axis. I want to control it more by specifying what the labels are, controling the 'size' of those labels (by using cex), and then control the rotation of the character strings of those labels (by using srt or crt). There is a "names" argument to boxplot, but I haven't had much luck controlling what it prints, the size of the font, and the character rotation. Can somebody enlighten me on how to do this? Please respond to my work email address: pzs6@cdc.gov Many thanks! Phil Smith Centers for Disease COntrol and Prevention [[alternative HTML version deleted]]
On Feb 22, 2007, at 2:56 PM, Smith, Phil ((CDC/CCID/NCIRD)) wrote:> boxplot( p.prop ~ R + bins ) > > This command makes nice boxplot for the factor "R" crossed with the > factor "bins". > > I am having alot of trouble getting control of the labels on the X > axis. I want to control it more by specifying what the labels are, > controling the 'size' of those labels (by using cex), and then > control the rotation of the character strings of those labels (by > using srt or crt). > > There is a "names" argument to boxplot, but I haven't had much luck > controlling what it prints, the size of the font, and the character > rotation.Would you consider an easy way out---an alternative with reasonable defaults? data(ToothGrowth) bwplot(dose ~ len | supp, ToothGrowth) _____________________________ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 Parcels: Room 102 Gilmer Hall McCormick Road Charlottesville, VA 22903 Office: B011 +1-434-982-4729 Lab: B019 +1-434-982-4751 Fax: +1-434-982-4766 WWW: http://www.people.virginia.edu/~mk9y/
Smith, Phil (CDC/CCID/NCIRD)
2007-Feb-23 14:36 UTC
[R] controling axes on boxplot() & thanks to ST, JvdH, & MK
Hi R-ers: I asked a question about how to control the axes on boxplot. Here is what worked: namz <- c( "R=1/Q1" , "R=0/Q1" , "R=1/Q2" , "R=0/Q2" , "R=1/Q3" , "R=0/Q3" , "R=1/Q4" , "R=0/Q4" ) boxplot( p.prop ~ R + bins , boxwex= .5 , plot = TRUE , axes = FALSE ) axis( side = 1 , at=c(1:8) , labels = namz , tick=TRUE , cex.axis = .8 , las=2 ) axis( side = 2 , at = seq(0,1,.1) , labels = seq(0,1,.1) ) My thanks to Steven Tucker, Joerg van den Hoff, and Michal Kubovy for their suggesions All the best, Phil Smith CDC -----Original Message----- From: Smith, Phil (CDC/CCID/NCIRD) Sent: Thu 2/22/2007 2:56 PM To: r-help@stat.math.ethz.ch Cc: Subject: question about boxplot Here is a question from an old guy: I want to use the boxplot function as follows: boxplot( p.prop ~ R + bins ) This command makes nice boxplot for the factor "R" crossed with the factor "bins". I am having alot of trouble getting control of the labels on the X axis. I want to control it more by specifying what the labels are, controling the 'size' of those labels (by using cex), and then control the rotation of the character strings of those labels (by using srt or crt). There is a "names" argument to boxplot, but I haven't had much luck controlling what it prints, the size of the font, and the character rotation. Can somebody enlighten me on how to do this? Please respond to my work email address: pzs6@cdc.gov Many thanks! Phil Smith Centers for Disease COntrol and Prevention [[alternative HTML version deleted]]