rasterly_points: rasterly_points

Description Usage Arguments Details Value See Also Examples

View source: R/rasterly_points.R

Description

Points layer for rasterly.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
rasterly_points(
  rastObj,
  data = NULL,
  mapping = aes(),
  ...,
  xlim = NULL,
  ylim = NULL,
  max_size = NULL,
  reduction_func = NULL,
  layout = NULL,
  glyph = NULL,
  group_by_data_table = NULL,
  inherit.aes = TRUE
)

Arguments

rastObj

A rasterly object.

data

A data.frame or function with an argument x, specifying the dataset to use for plotting. If data is NULL, the data argument provided to rasterly may be passed through.

mapping

Default list of aesthetic mappings to use for plot. If provided and inherit.aes = TRUE, it will be stacked on top of the mappings passed to rasterly.

...

Pass-through arguments provided by rasterly.

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 sum, any, mean, m2, first, last, min and max. Default is sum. See details.

layout

Character. The method used to generate layouts for multiple images. The default is weighted. Useful for categorical data (i.e. "color" is provided via aes()). weighted specifies that the final raster should be a weighted combination of each (categorical) aggregation matrix. Conversely, cover indicates that the afterwards objects will be drawn on top of the previous ones.

glyph

Character. Currently, only "circle" and "square" are supported; as the size of the pixels increases, how should they spread out – should the pattern be circular or square? Other glyphs may be added in the future.

group_by_data_table

Logical. Default is TRUE; when "color" is provided via aes(), the "group by" operation may be perfromed within data.table or natively within rasterly. Generally, group_by_data_table = TRUE is faster, but for very large datasets grouping within rasterly may offer better performance.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them.

Details

Reduction functions

Value

A list of environments.

See Also

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

Examples

 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)

rasterly documentation built on July 2, 2020, 2:12 a.m.