fortify.polygonGate {ggcyto} | R Documentation

## Convert a polygonGate to a data.table useful for ggplot

### Description

It converts the boundaries slot into a data.table When 'nPoints' is supplied, the method tries to interpolate the polygon with more verticies.

### Usage

    ## S3 method for class 'polygonGate'
    fortify(model, data = NULL, nPoints = NULL, ...)

### Arguments

`model` | polygonGate
`data` | data range used to reset off-bound gate coordinates to prevent interpolating on the extremely large space unnecessarily.
`nPoints` | total number of vertices of the polygon after interpolation. Default is NULL, which is no interpolation. The actual number may be more or less based on the lengths of edges due to the maximun and minimum limits on each edge. Interpolation is mainly for the purpose of plotting (so that it won't lose its shape from subsetting through 'limits'). But it is not necessary for other purposes like centroid calculation.
`...` | not used.

### Value

data.table

### Examples

    sqrcut <- matrix(c(300,300,600,600,50,300,300,50),ncol=2,nrow=4)
    colnames(sqrcut) <- c("FSC-H","SSC-H")
    pg <- polygonGate(filterId="nonDebris", .gate= sqrcut)
    fortify(pg) #no interpolation
    fortify(pg, nPoints = 30) # with interpolation

[Package ggcyto version 1.10.2 Index]