Description Usage Arguments Details Value Author(s) Examples

View source: R/subsetPointsByGrid.R

Subset points using a grid-based system, to avoid unnecessary rendering when plotting.

1 | ```
subsetPointsByGrid(X, Y, resolution = 200)
``` |

`X` |
A numeric vector of x-coordinates for all points. |

`Y` |
A numeric vector of y-coordinates for all points, of the same length as |

`resolution` |
A positive integer specifying the number of bins on each axis of the grid. |

This function will define a grid of the specified resolution across the plot. Each point is allocated to a grid location (i.e., pair of bins on the x- and y-axes). If multiple points are allocated to a given location, only the last/right-most point is retained. This mimics the fact that plotting will overwrite earlier points with later points. In this manner, we can avoid unnecessary rendering of earlier points that would not show up anyway.

Note that the `resolution`

should be a positive integer less than the square root of the maximum integer size,
and will be coerced into the valid range if necessary.
This enables fast calculation of the grid locations for all points.

For plots where `X`

and `Y`

are originally categorical, use the jittered versions as input to this function.

A logical vector indicating which points should be retained.

Aaron Lun

1 2 3 4 5 6 7 8 | ```
X <- rnorm(100000)
Y <- X + rnorm(100000)
summary(subsetPointsByGrid(X, Y, resolution=100))
summary(subsetPointsByGrid(X, Y, resolution=200))
summary(subsetPointsByGrid(X, Y, resolution=1000))
``` |

csoneson/iSEE documentation built on Dec. 13, 2018, 4:12 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.