rasterly
objectextract.Rd
The extract
function provides functionality for updating existing rasterly
objects.
# S3 method for rasterly [(x, name) # S3 method for rasterly [(x, name, ...) <- value
x | Object from which to extract element(s) or in which to replace element(s). |
---|---|
name | Character. A literal string to be extracted from |
... | (missing) or NULL. |
value | values to replace; typically an array-like R object of a similar class as x. |
Available names:
Aggregation: "data", "mapping", "plot_width", "plot_height", "range", "x_range", "y_range", "xlim", "ylim", "aesthetics", "reduction_func", "glyph", "max_size", "group_by_data_table", "drop_data", "variable_check"
Display: "background", "color", "alpha", "span", "show_raster", "layout"
Set level
in ...
. level
is numeric used for specifing level of `rasterly` object to modify;
default is 1 for the parent layer (rasterly()
).
library(rasterly) r <- rasterly( data = data.frame(x = 1:1e4, y = runif(1e4), category = sample(1:4, 1e4, replace = TRUE)), mapping = aes(x = x, y = y) ) %>% rasterly_points(xlim = c(1, 5000)) %>% rasterly_points( mapping = aes(x = x, y = y, color = category), xlim = c(5001, 1e4) ) r["mapping"]#> $rasterly_env #> Aesthetic mapping: #> * `x` -> `x` #> * `y` -> `y` #> #> $rasterlyPoints1 #> Aesthetic mapping: #> * `x` -> `x` #> * `y` -> `y` #> #> $rasterlyPoints2 #> Aesthetic mapping: #> * `x` -> `x` #> * `y` -> `y` #> * `color` -> `category` #>r["xlim"]#> $rasterly_env #> NULL #> #> $rasterlyPoints1 #> [1] 1 5000 #> #> $rasterlyPoints2 #> [1] 5001 10000 #># reassign parent `rasterly()` mapping r["mapping"] <- aes(x = x, y = y, color = category) r["mapping"]#> $rasterly_env #> Aesthetic mapping: #> * `x` -> `x` #> * `y` -> `y` #> * `colour` -> `category` #> #> $rasterlyPoints1 #> Aesthetic mapping: #> * `x` -> `x` #> * `y` -> `y` #> #> $rasterlyPoints2 #> Aesthetic mapping: #> * `x` -> `x` #> * `y` -> `y` #> * `color` -> `category` #>#> $rasterly_env #> Aesthetic mapping: #> * `x` -> `x` #> * `y` -> `y` #> #> $rasterlyPoints1 #> Aesthetic mapping: #> * `x` -> `x` #> * `y` -> `y` #> #> $rasterlyPoints2 #> Aesthetic mapping: #> * `x` -> `x` #> * `y` -> `y` #>