as.ggplot: It fortifies the data, fills some default settings and...

Description Usage Arguments Value Examples

View source: R/ggcyto.R

Description

The orginal data format is preserved during the ggcyo constructor because they still need to be used during the plot building process. This function is usually called automatically in the print/plot method of ggycyto. Sometime it is useful to coerce it to ggplot explictily by user so that it can be used as a regular ggplot object.

Usage

1
as.ggplot(x, pre_binning = FALSE)

Arguments

x

ggcyto object with the data that has not yet been fortified to data.frame.

pre_binning

whether to pass the binned data to ggplot to avoid the overhead to scaling the original raw data for geom_hex layer

Value

ggplot object

Examples

1
2
3
4
5
6
7
8
9
data(GvHD)
fs <- GvHD[1:3]
#construct the `ggcyto` object (inherits from `ggplot` class)
p <- ggcyto(fs, aes(x = `FSC-H`)) + geom_histogram() 
class(p) # a ggcyto object
p$data # data has not been fortified
p1 <- as.ggplot(p) # convert it to a ggplot object explictily 
class(p1) 
p1$data # data is fortified

Example output

Loading required package: ggplot2
Loading required package: flowCore
Loading required package: ncdfFlow
Loading required package: RcppArmadillo
Loading required package: BH
Loading required package: flowWorkspace
As part of improvements to flowWorkspace, some behavior of
GatingSet objects has changed. For details, please read the section
titled "The cytoframe and cytoset classes" in the package vignette:

  vignette("flowWorkspace-Introduction", "flowWorkspace")
[1] "ggcyto_flowSet"
attr(,"package")
[1] "ggcyto"
A flowSet with 3 experiments.

An object of class 'AnnotatedDataFrame'
  rowNames: s5a01 s5a02 s5a03
  varLabels: Patient Visit ... name (5 total)
  varMetadata: labelDescription

column names(8): FSC-H SSC-H ... FL4-H Time

[1] "gg"     "ggplot"
       .rownames Patient Visit Days Grade  name FSC-H
    1:     s5a01       5     1   -6     3 s5a01   371
    2:     s5a01       5     1   -6     3 s5a01   190
    3:     s5a01       5     1   -6     3 s5a01   141
    4:     s5a01       5     1   -6     3 s5a01   167
    5:     s5a01       5     1   -6     3 s5a01   128
   ---                                               
10256:     s5a03       5     3    6     3 s5a03   231
10257:     s5a03       5     3    6     3 s5a03   197
10258:     s5a03       5     3    6     3 s5a03    76
10259:     s5a03       5     3    6     3 s5a03   346
10260:     s5a03       5     3    6     3 s5a03   367

ggcyto documentation built on Nov. 8, 2020, 5:30 p.m.