data(GvHD)
GvHD <- GvHD[pData(GvHD)$Patient %in% 5:6]
## a bivariate scatterplot
## by default ('smooth=TRUE') panel.smoothScatter is used
xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], nbin = 100,
main="A single flowFrame")
## A non-smooth version of the same data
xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], nbin = 100,
main="A single flowFrame", smooth=FALSE)
## A non-smooth version of the same data with customerized color scheme
require(IDPmisc)
colramp <- colorRampPalette(IDPcolorRamp(21))
xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], nbin = 100,
main="A single flowFrame", smooth=FALSE,
colramp=colramp, pch=20, cex=0.1)
## A hexbin version of non-smooth scatter plot
xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], xbin = 128
,main="A single flowFrame", smooth=FALSE)
## Visual artifacts created by the pileup of margin events
xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], nbin = 100,
main="A single flowFrame", margin=FALSE)
## simple bivariate scatter plot (a.k.a. dot plot)
## for the whole flowSet, conditioning on Patient and
## Visit
xyplot(`SSC-H` ~ `FSC-H` | Patient:Visit, data = GvHD)
## Same bivariate scatter plot with replacing default color
require(IDPmisc)
cols <- colorRampPalette(IDPcolorRamp(21))
xyplot(`SSC-H` ~ `FSC-H` | Patient:Visit, data = GvHD, colramp=cols)
## several examples with time on the X axis
## first for a flowFrame
xyplot(GvHD[[1]])
## and for flowSets
xyplot(`FSC-H` ~ Time | Visit, GvHD,
smooth = FALSE, type = "l",
subset = (Patient == 5), xbin = 32)
xyplot(`FSC-H` ~ Time | Patient+Visit, GvHD,
smooth = FALSE, type = "a",
strip = FALSE, strip.left = TRUE,
aspect = "xy", xbin = 32)
## combine plots for two channels
ssc.time <-
xyplot(`SSC-H` ~ Time | factor(Patient):factor(Visit), GvHD,
smooth = FALSE, type = "a",
strip = FALSE,
strip.left = strip.custom(horizontal = TRUE),
par.strip.text = list(lines = 3),
between = list(y = rep(c(0, 0.5), c(6, 1))),
scales = list(x = list(axs = "i"), y = list(draw = FALSE)),
layout = c(1, 14), xbin = 32)
fsc.time <-
xyplot(`FSC-H` ~ Time | factor(Patient):factor(Visit), GvHD,
smooth = FALSE, type = "a",
strip = FALSE,
strip.left = strip.custom(horizontal = TRUE),
par.strip.text = list(lines = 3),
between = list(y = rep(c(0, 0.5), c(6, 1))),
scales = list(x = list(axs = "i"), y = list(draw = FALSE)),
layout = c(1, 14), xbin = 32)
plot(fsc.time, split = c(1, 1, 2, 1))
plot(ssc.time, split = c(2, 1, 2, 1), newpage = FALSE)
## saving plots as variables allows more manipulation
plot(update(fsc.time[8:14], layout = c(1, 7)),
split = c(1, 1, 1, 2))
plot(update(ssc.time[8:14], layout = c(1, 7)),
split = c(1, 2, 1, 2), newpage = FALSE)
## displaying filters
n2gate <- norm2Filter("SSC-H", "FSC-H")
xyplot(`SSC-H` ~ `FSC-H` | Patient:Visit, data = GvHD,
filter=n2gate, subset=Patient==5)
xyplot(`SSC-H` ~ `FSC-H` | Patient:Visit,
data=transform("SSC-H"=asinh,"FSC-H"=asinh) %on% GvHD,
smooth=FALSE, filter=n2gate, subset=Patient == 5, xbin = 32)
## displaying filters with stats
n2gate.results <- filter(GvHD, n2gate)
xyplot(`SSC-H` ~ `FSC-H` | Visit, data=GvHD,
subset=Patient == "6",
filter=n2gate.results, smooth=FALSE, xbin = 32
,stats=TRUE
,abs=TRUE
,digits=3
)
## displaying multiple filters in one panel with stats
recGate1<-rectangleGate("FL3-H"=c(2.3,4.1),"FL2-H"=c(6.8,9))
recGate2<-rectangleGate("FL3-H"=c(1,3),"FL2-H"=c(4,6))
filters1<-filters(list(recGate1,recGate2))
trans<-transform("FL2-H"=asinh,"FL3-H"=asinh)
trans_data<-transform(GvHD[1:2],trans)
#replicate filters object across samples
flist <- list(filters1 , filters1)
names(flist) <- sampleNames(trans_data)
xyplot(`FL2-H` ~ `FL3-H`
,data=trans_data
,filter= flist
,stats=TRUE
,margin=FALSE
, xbin = 32
, smooth = FALSE
)
#display recGate2 as a overlay
overlay <- Subset(trans_data,recGate1)
xyplot(`FL2-H` ~ `FL3-H`
,data=trans_data
,filter=recGate2
,stats=TRUE
,margin=FALSE
, smooth = FALSE
, xbin = 32
,overlay= list(rect2 = overlay)
,par.settings = list(overlay.symbol = list(cex = 0.1))
)
Run the code above in your browser using DataLab