rotate_gate: Simplified geometric rotation of gates

View source: R/transform_gate-methods.R

rotate_gateR Documentation

Simplified geometric rotation of gates

Description

Rotate a Gate-type filter object through a specified angle

Usage

## Default S3 method:
rotate_gate(obj, deg = NULL, rot_center = NULL, ...)

Arguments

obj

An ellipsoidGate or polygonGate

deg

An angle in degrees by which the gate should be rotated in the counter-clockwise direction

rot_center

A separate 2-dimensional center of rotation for the gate, if desired. By default, this will be the center for ellipsoidGate objects or the centroid for polygonGate objects. The rot_center argument is currently only supported for polygonGate objects.

...

Additional arguments not used

Details

This method allows for 2-dimensional geometric rotation of filter types defined by simple geometric gates (ellipsoidGate, and polygonGate). The method is not defined for rectangleGate or quadGate objects, due to their definition as having 1-dimensional boundaries. Further, keep in mind that the 2-dimensional rotation takes place in the plane where the dimensions of the two variables are evenly linearly scaled. Displaying a rotated ellipse in a plot where the axes are not scaled evenly may make it appear that the ellipse has been distorted even though this is not the case.

The angle provided in the deg argument should be in degrees rather than radians. By default, the rotation will be performed around the center of an ellipsoidGate or the centroid of the area encompassed by a polygonGate. The rot_center argument allows for specification of a different center of rotation for polygonGate objects (it is not yet implemented for ellipsoidGate objects) but it is usually simpler to perform a rotation and a translation individually than to manually specify the composition as a rotation around a shifted center.

Value

A Gate-type filter object of the same type as gate, with the rotation applied

Examples

## Not run: 
#' # Rotates the original gate 15 degrees counter-clockwise
rotated_gate <- rotate_gate(original_gate, deg = 15)
# Rotates the original gate 270 degrees counter-clockwise
rotated_gate <- rotate_gate(original_gate, 270)

## End(Not run)


RGLab/flowCore documentation built on Aug. 26, 2024, 8:52 a.m.