Description Usage Arguments Details Value See Also Examples

View source: R/rasterly_points.R

Points layer for `rasterly`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 |

`rastObj` |
A |

`data` |
A |

`mapping` |
Default list of aesthetic mappings to use for plot. If provided and |

`...` |
Pass-through arguments provided by |

`xlim` |
Vector of type numeric. X limits in this layer. |

`ylim` |
Vector of type numeric. Y limits in this layer. |

`max_size` |
Numeric. When size changes, the upper bound of the number of pixels over which to spread a single observation. |

`reduction_func` |
Function. A reduction function is used to aggregate data points into their pixel representations. Currently
supported reduction operators are |

`layout` |
Character. The method used to generate layouts for multiple images. The default is |

`glyph` |
Character. Currently, only "circle" and "square" are supported; as the |

`group_by_data_table` |
Logical. Default is |

`inherit.aes` |
If |

Reduction functions

`sum`

: If`on`

is not provided within`aes()`

, the default is to take the sum within each bin. When`on`

is specified, the function reduces by taking the sum of all elements within the variable named in`on`

.`any`

: When`on`

is provided within`aes()`

, the`any`

reduction function specifies whether any elements in`on`

should be mapped to each bin.`mean`

: If`on`

is not provided in mapping`aes()`

,`on`

would be set as variable "y" by default. When`on`

is given, the`mean`

reduction function takes the mean of all elements within the variable specified by`on`

.`m2`

: Requires that`on`

is specified within`aes()`

. The`m2`

function computes the sum of square differences from the mean of all elements in the variable specified by`on`

.`var`

: Requires that`on`

is specified within`aes()`

. The`var`

function computes the variance over all elements in the vector specified by`on`

.`sd`

: Requires that`on`

is specified within`aes()`

. The`sd`

function computes the standard deviation over all elements in the vector specified by`on`

.`first`

: Requires that`on`

is specified within`aes()`

. The`first`

function returns the first element in the vector specified by`on`

.`last`

: Requires that`on`

is specified within`aes()`

. The`last`

function returns the last element in the vector specified by`on`

.`min`

: Requires that`on`

is specified within`aes()`

. The`min`

function returns the minimum value in the vector specified by`on`

.`max`

: Requires that`on`

is specified within`aes()`

. The`min`

function returns the maximum value in the vector specified by`on`

.

A list of environments.

rasterly, rasterly_build, [.rasterly, [<-.rasterly

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
## Not run:
library(rasterly)
if(requireNamespace("grid") && requireNamespace("gridExtra")) {
x <- rnorm(1e7)
y <- rnorm(1e7)
category <- sample(1:5, 1e7, replace = TRUE)
data.frame(x = x, y = y, category = category) %>%
rasterly(mapping = aes(x = x, y = y, color = category)) %>%
rasterly_points(layout = "weighted") -> ds1
ds1
# layout with cover
data.frame(x = x, y = y, category = category) %>%
rasterly(mapping = aes(x = x, y = y, color = category)) %>%
rasterly_points(layout = "cover") -> ds2
ds2
# display side by side
grid::grid.newpage()
gridExtra::grid.arrange(
grobs = list(rasterlyGrob(ds1), rasterlyGrob(ds2)),
ncol = 2,
top = "'weighted' layout versus 'cover' layout"
)
}
## End(Not run)
``` |

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.