[BioC] flowViz Plots Gate Outline and grid.newpage()/viewport Issue

Florian Hahne fhahne at fhcrc.org
Tue Apr 14 02:09:55 CEST 2009


Hi Aric,
I don't quite follow why you have to draw the plot twice to get the gate 
outline. This works on my installation:
library(flowViz)
data(GvHD)
tmp <- GvHD[[1]]
rg <- rectangleGate("FSC-H"=c(100, 200), "SSC-H"=c(400, 800))
xyplot(`SSC-H`~`FSC-H`, tmp, smooth=FALSE, filter=rg, outline=T)

I am also not sure why you want to place individual plots manually. 
xyplot knows how to deal with flowSets, so the following works fine:
xyplot(`SSC-H`~`FSC-H`, GvHD[1:3], smooth=FALSE, filter=rg, outline=T)
and if you want to pass in separate filter objects for each frame you 
can do so by means of a list.

Lattice graphics gives pretty much all the freedom to control the 
placing of the individual frames, and you might consider Deepayan 
Sarkar's Lattice book as a reference. If you really want to produce 
lattice objects and manually place them on a graphics device, the split 
option of the lattice plot method could be helpful.
Florian




Aric Gregson wrote:
> Hello,
>
> I realize that with the version of flowViz I am running (1.7.10) that
> if I draw a scatterplot with smooth=F and attempt to draw the gate
> outline the first drawing of the plot will not show the outline, but
> subsequent attempts will. To generate pdf figures that show the gate
> outline, I just draw the plot twice prior to submitting it to the pdf
> device and the gate outline is there in the pdf file. 
>
> However, I now am placing multiple figures in the same pdf page as
> below and wonder if there is another method to do this. 
>
> Example plot:
>
> plot344lymph<-xyplot(`FSC.A` ~ `SSC.A`, Data(wf[["CD3+"]])[[6]],
> xlim=c(0, 8),
> ylim=c(0, 120000),
> filter=lymphscatfilter,
> smooth=F,
> alpha=0.6,
> pch=21,
> cex=0.1,                     
> outline=TRUE,
> names=TRUE,
> #scales=list(tick.number= 10),
> main="Lymphocyte Gate\nSinglet Live CD3/CD4+",
> xlab="Side Scatter Area",
> ylab="Forward Scatter Area",
> par.settings=list(gate=list(col="purple", alpha=.4),
>    gate.text=list(col="black", alpha=0.7, cex=0.6)))      
>
> Code to generate multiple plots on one pdf page:
>
> pdf(file="grid344.pdf", width=11, height=8.5)
> grid.newpage()
> pushViewport(viewport(layout = grid.layout(2, 3)))
> pushViewport(viewport(layout.pos.col=1, layout.pos.row=1))
> print(plot344singlet, newpage = FALSE)
> popViewport(1)
> #
> pushViewport(viewport(layout.pos.col=1, layout.pos.row=1))
> print(plot344singlet, newpage = FALSE)
> popViewport(1)
>
> pushViewport(viewport(layout.pos.col=2, layout.pos.row=1))
> print(plot344live, newpage = FALSE)
> popViewport()
> #
> pushViewport(viewport(layout.pos.col=2, layout.pos.row=1))
> print(plot344live, newpage = FALSE)
> popViewport()
>
> ...etc. for each plot. 
>
> Is there a more elegant and less compute intensive way to do this?
>
> Thanks in advance.
>
>   


-- 
Florian Hahne, PhD
Computational Biology Program
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
PO Box 19024
Seattle, Washington 98109-1024
206-667-3148
fhahne at fhcrc.org



More information about the Bioconductor mailing list