Subset points using a grid-based system, to avoid unnecessary rendering when plotting.
subsetPointsByGrid(X, Y, resolution = 200)
A numeric vector of x-coordinates for all points.
A numeric vector of y-coordinates for all points, of the same length as
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
Y are originally categorical, use the jittered versions as input to this function.
A logical vector indicating which points should be retained.
1 2 3 4 5 6 7 8
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.