[BioC] lattice and base-graphics using gridBase

James W. MacDonald jmacdon at med.umich.edu
Tue May 11 14:54:04 CEST 2010


Hi Maarten,

Maarten van Iterson wrote:
> Dear list, 
> 
> I'm trying to combine lattice and base-graphics following the example
> from Paul Murrell's R Graphics (B.1.2). 
> 
> The question I have is how to add the y-axis from the base-graphics to
> the lattice plot below?

Neither of these packages are part of Bioconductor, so I think you would 
be better served asking this question on the R-help listserv.

Best,

Jim


> 
> library(gridBase)
> library(lattice)
> 
> data <- list(A=matrix(rnorm(8*100, 1, 1), ncol=8), B=matrix(rnorm(8*100,
> 0, 1), ncol=8), C=matrix(rnorm(8*100, -1, 1), ncol=8))
> 
> boxplot.panel <- function(x, y, subscripts, ...){	
> 	pushViewport(viewport(gp=gpar(fontsize=8)),
>                viewport(y=unit(0.95, "npc"), width=0.9,
> height=unit(0.95, "npc"), just="top"))
>   par(plt=gridPLT(), new=TRUE, ps=8)  
> 	boxplot(data[[subscripts]], col=rep(2:7, each=2), ylab="", axes=FALSE,
> names=NULL, outline=FALSE) 
>   popViewport(2)
> }
> 
> df <- data.frame(y=1:3, x=1:3, Method=LETTERS[1:3])
> 
> xyplot(y ~ x | Method, data=df, subscripts=TRUE, xlab="", ylab="",
> panel=boxplot.panel, layout=c(1,3))
> 
> sessionInfo()
> R version 2.10.0 (2009-10-26) 
> x86_64-unknown-linux-gnu 
> 
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
>  [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8   
>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
> 
> attached base packages:
> [1] grid      stats     graphics  grDevices utils     datasets
> methods  
> [8] base     
> 
> other attached packages:
> [1] lattice_0.17-26 gridBase_0.4-3 
> 
> Thanks in advance, 
> 
> Maarten
> 
> 

-- 
James W. MacDonald, M.S.
Biostatistician
Douglas Lab
University of Michigan
Department of Human Genetics
5912 Buhl
1241 E. Catherine St.
Ann Arbor MI 48109-5618
734-615-7826
**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues 



More information about the Bioconductor mailing list