geom_stats {ggcyto} | R Documentation |
It is a virtual layer and will be instanatiated as geom_label layer within ggycto.+ operator.
geom_stats(gate = NULL, ..., value = NULL, type = "percent", data_range = NULL, negated = FALSE, adjust = 0.5, label.padding = unit(0.05, "lines"), label.size = 0, digits = 3)
gate |
a 'filterList' or character (represent as a population node in GatingSet) if not supplied, ggcyto then tries to parse the gate from the first geom_gate layer. |
... |
other arguments passed to geom_label layer |
value |
the pre-calculated stats value. when supplied, the stats computing is skipped. |
type |
can be "percent", "count" or "MFI" (MFI is currently not supported yet). |
data_range |
a data.frame that specifies the data range for each channels (see examples for its format.) Default is the instrument range extracted from fs object. |
negated |
whether the gate needs to be negated |
adjust |
adjust the position of the centroid. from 0 to 1. |
label.padding, label.size |
arguments passed to geom_label layer |
digits |
control the stats format |
So it is dedicated for ggcyto context and thus can't not be added to ggplot object directly.
a geom_popStats layer
dataDir <- system.file("extdata",package="flowWorkspaceData") gs <- load_gs(list.files(dataDir, pattern = "gs_manual",full = TRUE)) p <- ggcyto(gs, aes(x = CD4, y = CD8), subset = "CD3+") + geom_hex(bins = 64) p # add gate and stats layer p + geom_gate("CD4") + geom_stats() #sometime the stats are not shown (or positoned not properly) due to the inaccurate default instrument measurement range #stored in flow data. then it will be necessary to correct that by supplying the actual 'data_range' fr <- getData(gs)[[1]] rng <- range(fr, type = "data") p + geom_gate("CD4") + geom_stats(data_range = rng)