fority methods empower
ggplot to work with all the major Cytometry data structures right away, which allows users to do all kinds of highly customized and versitled plots.
gs <- load_gs(list.files(dataDir, pattern = "gs_manual",full = TRUE)) attr(gs, "subset") <- "CD3+" ggplot(gs, aes(x = `<B710-A>`, y = `<R780-A>`)) + geom_hex(bins = 128) + scale_fill_gradientn(colours = gray.colors(9))
fs <- gs_pop_get_data(gs, "CD3+") ggplot(fs, aes(x = `<B710-A>`)) + geom_density(fill = "blue", alpha= 0.5)
ggcyto constructor along with overloaded
+ operator encapsulate lots of details that might be tedious and intimidating for many users.
It simplies the plotting by: * add a default scale_fill_gradientn for you * fuzzy-matching in
aes by either detector or fluorochromes names * determine the
parent popoulation automatically * exact and plot the gate object by simply referring to the
child population name
Inheriting the spirit from ggplot’s
Quick plot, it further simply the plotting job by hiding more details from users and taking more assumptions for the plot.
flowSet, it determines
geomtype automatically by the number of
GatingSet, it further skip the need of
dimby guessing it from the
#1d autoplot(fs, "CD4")
#2d autoplot(fs, "CD4", "CD8", bins = 64)
It is done by different
scales layers speically designed for
p + scale_x_logicle() #flowCore logicle scale
p + scale_x_flowJo_fasinh() # flowJo fasinh
p + scale_x_flowJo_biexp() # flowJo biexponential
It hides the complex details pf plotting different geometric shapes
fr <- fs[] p <- autoplot(fr,"CD4", "CD8") + ggcyto_par_set(limits = "instrument") #1d gate vertical gate_1d_v <- openCyto::gate_mindensity(fr, "<B710-A>") p + geom_gate(gate_1d_v)
#ellipsoid Gate gate_ellip <- gh_pop_get_gate(gs[], "CD4") class(gate_ellip)
##  "ellipsoidGate" ## attr(,"package") ##  "flowCore"
p + geom_gate(gate_ellip)
p <- ggcyto(gs, aes(x = "CD4", y = "CD8"), subset = "CD3+") + geom_hex() p + geom_gate("CD4") + geom_stats()
It can display the
log scaled data in the original value
p # axis display the transformed values
p + axis_x_inverse_trans() # restore the x axis to the raw values
It currently only works with
Optionally you can set limits by
p <- p + ggcyto_par_set(limits = "instrument") p
You can choose between
channel names (or
both by default)
p + labs_cyto("markers")
It aggregates the different settings in one layer
#put all the customized settings in one layer mySettings <- ggcyto_par_set(limits = "instrument" , facet = facet_wrap("name") , hex_fill = scale_fill_gradientn(colours = rev(RColorBrewer::brewer.pal(11, "Spectral"))) , lab = labs_cyto("marker") ) # and use it repeatly in the plots later (similar to the `theme` concept) p + mySettings
Currently we only support
4 settings, but will add more in future.
It allows user to convert
ggcyto objects to pure
ggplot objects for further the manipulating jobs that can not be done within
class(p) # may not fully compatile with all the `ggplot` functions
##  "ggcyto_GatingSet" ## attr(,"package") ##  "ggcyto"
##  "gg" "ggplot"
Layout many gate plots on the same page
When plooting a
GatingHierarchy, multiple cell populations with their asssociated gates can be plotted in different panels of the same plot.
gh <- gs[] nodes <- gs_get_pop_paths(gh, path = "auto")[c(3:9, 14)] nodes
##  "singlets" "CD3+" "CD4" "CD4/38- DR+" "CD4/38+ DR+" ##  "CD4/38+ DR-" "CD4/38- DR-" "CD8"
##  "ggcyto_GatingLayout" ## attr(,"package") ##  "ggcyto"
As you see, this generates a special
ggcyto_GatingLayout object which is a container storing multiple
ggcyto objects. You can do more about the plot layout with the helper function
ggcyto_arrange. For example, to arrange it as one-row gtable object
##  "gtable" "gTree" "grob" "gDesc"
or even combine it with other
ggcyto_GatingLayout objects(or any
gtable objects) and print it on the sampe page
p2 <- autoplot(gh_pop_get_data(gh, "CD3+")[,5:8]) # some density plot firstname.lastname@example.org <- ""#clear the default title gt2 <- ggcyto_arrange(p2, nrow = 1) gt3 <- gridExtra::gtable_rbind(gt, gt2) plot(gt3)