[BioC] Overlay Density Plot for FlowSet

Florian Hahne fhahne at fhcrc.org
Fri Oct 3 22:31:57 CEST 2008

Hi Aric,
I don't fully understand what you are trying to plot. Is your data 
one-dimensional, i.e., do you want to compare the densities (or 
histograms) of a single fluorescence parameter for several tubes? Then 
the densityplot function should be able to do that:

densityplot(name ~ `FL2.W`, CD3.4.fp3Live.subset[c(1,5)])

You say that CD3.4.fp3Live.subset is already a subset of the original 
data and I am not sure which gate you want to add to this plot. Also you 
don't say what type of gate you applied. Assuming that g is the gate you 
used to filter and subset CD3.4.fp3Live, resulting in 
CD3.4.fp3Live.subset, and that you filtered on the FL2.W parameter, you 
could add the gate to your plot like this:

densityplot(name ~ `FL2.W`, CD3.4.fp3Live[c(1,5)], filter=g)

If the gate is not on FL2.W there isn't a reasonable way to add the gate 
to the one-dimensional density plot.  And if CD3.4.fp3Live.subset is the 
result of your gating it doesn't make much sense, either. It would be in 
the empty region of the plot.

In the 2D situation you can't easily overlay xyplots, but  you can plot 
them in a trellis layout adding the gate as argument "filter" similar to 
the previous densityplot example. However, you can overlay contour plots:

cols <- rainbow(3, alpha=0.1)
contour(CD3.4.fp3Live[c(1,5)], col=cols, fill=cols)

Let me know if that doesn't address your problem. Also please provide 
the output of sessionInfo() in future posts, it's much easier to answer 
questions if we know the R and package versions you are working on.


Aric Gregson wrote:
> Apologies if this is obvious or has already been discussed, but I am
> struggling with how to do this from within flowCore/Viz using R 2.7.0.
> I have filtered and subseted the data now that I would like to plot an
> overlay density plot of a full fluorescence tube over a FMO tube and
> demonstrate the positive gate. I have been able to construct a not so
> interesting histogram plot as below:
> plot(CD3.4.fp3Live.subset[[1]], "FL2.W", breaks=256, col=c("black"),
> main="Overlay Plot FMO for CCR7\nFMO (CCR7-) Blue\nFull Fluorescent
> Tube (CCR7+) Black") 
> plot(CD3.4.fp3Live.subset[[5]], "FL2.W", breaks=256, col=c
> ("dodgerblue"), add=T)
> But there is no indication of the gate and the histograms are difficult
> to read in this manner. 
> Another option that may work to visualize this, would be to overlay dot
> plot with xyplot and show the gate somehow. But this is beyond me
> currently.
> Thanks for any suggestions, 
> aric
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

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

More information about the Bioconductor mailing list