Learn R Programming

arcpullr (version 0.3.2)

raster_colors,SpatRaster-method: Convert SpatRaster into data.frame of colors that can be used for plotting

Description

This function is used internally by plot_layer to convert a SpatRaster object to a data.frame of colors for each pixel that can be used for plotting with ggplot2. Note that this function assumes that the SpatRaster objects use RGB values.

Usage

# S4 method for SpatRaster
raster_colors(x)

Value

A data.frame with 3 columns and length(raster_object) rows

Arguments

x

A SpatRaster object

Examples

Run this code
if (FALSE) {
wi_leaf_off_layer <- get_image_layer(wi_leaf_off_url, wis_poly)
wi_leaf_off_data <- raster_colors(wi_leaf_off_layer)
}

Run the code above in your browser using DataLab