library(ggcyto)
dataDir <- system.file("extdata",package="flowWorkspaceData")
gs <- load_gs(list.files(dataDir, pattern = "gs_manual",full = TRUE))
data(GvHD)
fs <- GvHD[subset(pData(GvHD), Patient %in%5 & Visit %in% c(5:6))[["name"]]]
flowSet
geom_density
layer is used for one-dimensional plot.
autoplot(fs, x = 'FSC-H')
geom_hex
layer is added for 2d plot.
autoplot(fs, x = 'FSC-H', y = 'SSC-H', bins = 64)
GatingSet
autoplot(gs, "CD3+", bins = 64)
Here are some default settings applied:
ggcyto_par_set(limits = "instrument")
).axis_x_inverse_trans/axis_x_inverse_trans
.Multiple gates that share the same parent can be plotted together.
autoplot(gs, c("CD4", "CD8"), bins = 64)
GatingHierarchy
Multiple cell populations with their asssociated gates can be plotted in different panels of the same plot.
gh <- gs[[1]]
nodes <- getNodes(gh, path = "auto")[c(3:9, 14)]
nodes
## [1] "singlets" "CD3+" "CD4" "CD4/38- DR+" "CD4/38+ DR+"
## [6] "CD4/38+ DR-" "CD4/38- DR-" "CD8"
autoplot(gh, nodes, bins = 64)
Optionally we can disable default grid.arrange
behavior and receive a list of ggplot objects instead and manually arrange these individual ggplot
objects.
objs <- autoplot(gh, nodes, bins = 64, arrange = FALSE)
length(objs)
## [1] 4
class(objs[[1]])
## [1] "ggcyto_GatingSet"
## attr(,"package")
## [1] "ggcyto"
class(objs[[2]])
## [1] "ggcyto_GatingSet"
## attr(,"package")
## [1] "ggcyto"