Re: [R] question about boxplot

2007-02-23 Thread Stephen Tucker
You can also set axes=FALSE as in

boxplot( p.prop ~ R  + bins, axes=FALSE )

and then add your own labels with axis(). the argument 'at' for axis() in the
case of boxplots are usually integers going from 1 to # of groups, though I
don't know specifically for your crossed factors.

For rotated names, you probably want to set axis(#arguments#,labels=FALSE)
and then use text() with 'srt' (don't forget to use xpd=TRUE in text()).
par(cxy) may help with positioning text relative to axis.

all the best,

st


--- Michael Kubovy [EMAIL PROTECTED] wrote:

 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 400400Charlottesville, VA 22904-4400
 Parcels:Room 102Gilmer Hall
  McCormick RoadCharlottesville, 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/
 
 __
 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
 and provide commented, minimal, self-contained, reproducible code.
 



 

Never miss an email again!

__
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
and provide commented, minimal, self-contained, reproducible code.


[R] question about boxplot

2007-02-22 Thread Smith, Phil \(CDC/CCID/NCIRD\)
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: [EMAIL PROTECTED]
 
Many thanks!
Phil Smith
Centers for Disease COntrol and Prevention

[[alternative HTML version deleted]]

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] question about boxplot

2007-02-22 Thread Michael Kubovy
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 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, 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/

__
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
and provide commented, minimal, self-contained, reproducible code.


[R] question about boxplot axis

2005-07-04 Thread yyan liu
Hi:
  I have a question making side by side boxplot. 
  My response is numeric and I want to make a side by
side boxplot of it accroding to a factor vector. So,
there are several boxplots on the same plot. Each
boxplot is with respect to one level for a factor. The
levels of
the factor are some characters. When I make the plot,
the boxplots are arranged according to the alphabetic
order of the levels. My question is that how I can
change the order the boxplots are arranged. For
example, 
 
   fac-c(a,b,c,d)
   boxplot(time.vec~fac,xlab=Events,ylab=Time In
Days,col=yellow)

Then the boxplots are arranged in the order of
a,b,c,d. But for some reason, I want it to be
c,a,d,b. Any suggestion about this question?

thx a lot!

liu zhong

__
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


Re: [R] question about boxplot axis

2005-07-04 Thread Marc Schwartz
On Mon, 2005-07-04 at 11:35 -0700, yyan liu wrote:
 Hi:
   I have a question making side by side boxplot. 
   My response is numeric and I want to make a side by
 side boxplot of it accroding to a factor vector. So,
 there are several boxplots on the same plot. Each
 boxplot is with respect to one level for a factor. The
 levels of
 the factor are some characters. When I make the plot,
 the boxplots are arranged according to the alphabetic
 order of the levels. My question is that how I can
 change the order the boxplots are arranged. For
 example, 
  
fac-c(a,b,c,d)
boxplot(time.vec~fac,xlab=Events,ylab=Time In
 Days,col=yellow)
 
 Then the boxplots are arranged in the order of
 a,b,c,d. But for some reason, I want it to be
 c,a,d,b. Any suggestion about this question?
 
 thx a lot!
 
 liu zhong



time.vec - rnorm(40)
fac - factor(sample(letters[1:4], 40, replace = TRUE))

# Default ordering
boxplot(time.vec ~ fac, xlab=Events, 
ylab=Time In Days, col=yellow)


# Now adjust factor levels as you desire
fac - factor(fac, levels = c(c, a, d, b))

# Redo boxplot with new ordering
boxplot(time.vec ~ fac, xlab=Events, 
ylab=Time In Days, col=yellow)


See ?factor for more information. boxplot() sequences the boxes based
upon the factor levels.

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