[R] horizontal yaxis label

Chuck Cleland ccleland at optonline.net
Tue Jun 27 13:34:18 CEST 2006


Marc Bernard wrote:
> Dear all,
>    
>   I wonder how to get  an  horizontal   label for the y axis in the plot function. I have looked at par and many function but didn't find it.
>   more specifically , let:
>    
>   df <- data.frame(cbind(1:10, 11:20))
>   names(df) <- c("y","x")
>    
>   plot(y ~ x, data = df, ylab = "dependent")
>    
>   how to ask R to have the label "independent" in an horizontal form?

   I think you want something like this:

df <- data.frame(cbind(1:10, 11:20))
names(df) <- c("y","x")

par(mar = c(7, 10, 7, 7))
plot(y ~ x, data = df, ylab = "", xlab = "independent")
text(par("usr")[1] - 1, 5.5, adj = 1, labels = "dependent", xpd = TRUE)

   Adapted from the example in section 7.27 of 
http://cran.r-project.org/doc/FAQ/R-FAQ.html

>   I have another question concerning the xyplot:
>    
>   Suppose that I have made an xyplot with 4 panels defined by one factor variable. How may I have a blank space between the four panels?

   See the between argument.  For example:

library(lattice)

df2 <- data.frame(Y = runif(20), X = rnorm(20), G = 
rep(c("A","B","C","D"), each=5))

xyplot(Y ~ X | G, data = df2, layout=c(2,2), between=list(x=1,y=1))

>   Thank you,
>    
>   Bernard,
>    
>    
>    
>    
> 
>  		
> ---------------------------------
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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
> 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894



More information about the R-help mailing list