ggcyto : Visualize Cytometry data with ggplot

ggcyto is a cytometry data visualization tool built around ggplot and the grammar of graphics paradigm. The software extends the popular ggplot2 framework, already familiar to many data scientists, enabling it to recog-nize the core Bioconductor flow cytometry data structures for gated and annotated cytometry data. It simplifies visualization and plotting of flow data for publication quality graphics.

There are three ways to construct the ggcyto plots. Each represents a different level of complexity and flexibility. They meet the needs of various plot applications and thus are suitable for users at different levels of coding skills.

Quick plot

This inherits the spirit from ggplot’s Quick plot, which simplies the plotting job by hiding more details from users and taking more assumptions for the plot.

More flexibility with ggcyto wrapper

ggcyto constructor along with overloaded + operator gives user more flexibility to fine-tune the plot yet still encapsulates lots of details that might be tedious and intimidating for many users.

See more examples of ggcyto constructor here:

Use ggplot directly to have more controls.

The package overloads ggplot’s fortify S3 method so that Cytometry data structures (e.g. flowSet/flowFrame) are fully compatible with ggplot. More examples of using ggplot directly on flowSet:

quick demos of some most used features

library(ggcyto)
dataDir <- system.file("extdata",package="flowWorkspaceData")
gs_orig <- load_gs(list.files(dataDir, pattern = "gs_bcell_auto",full = TRUE))
gs <- gs_clone(gs_orig)

#change the resolution
p <- autoplot(gs, "CD3", bins = 64)
p

gs1 <- gs[1]
gs2 <- gs[2]
#construct the ggcyto object for gs1
p <- ggcyto(gs1, aes(cd24, cd38)) + geom_hex(bins = 128)
p <- p + geom_gate("Transitional") #add gate
#customize the stats layer
p <- p + geom_stats(type = "count", size = 6,  color = "red", fill = "green", adjust = 0.7)
#customize the layer
p <- p + labs_cyto("channel")
#customize the axis limits
p <- p + ggcyto_par_set(limits = "instrument")
#add another population as the overlay dots
p <- p + geom_overlay("IgD-CD27-", col = "black", size = 1.2, alpha = 0.4)
#hide the legend
p <- p + guides(fill=FALSE)
p

autoplot(fs, "CD20") #1d density