plot_GRASS {rdwplus}R Documentation

A function to plot a raster from the current GRASS mapset

Description

Given the name of a raster in the current GRASS mapset, this function will plot it as a stars object.

Usage

plot_GRASS(x, colours, out_x, ...)

Arguments

x

The name of an object in the current GRASS mapset.

colours

Optional. A colour scale. If not supplied, the default settings in plot.stars is used. If supplied, length(colours) must be less than or equal to the number of unique values in the raster.

out_x

Optional. If supplied, the function makes a call to retrieve_raster and writes out the raster to the file path out_x. Otherwise the function will write the layer to tempdir.

...

Additional arguments to plot.stars.

Value

Nothing.

Examples

# Will only run if GRASS is running
# You should load rdwplus and initialise GRASS via the initGRASS function
if(check_running()){

# Load data set
dem <- system.file("extdata", "dem.tif", package = "rdwplus")

# Set environment 
set_envir(dem)

# Plot
plot_GRASS("dem.tif") # argument must match name of data set in the mapset
plot_GRASS("dem.tif", heat.colors(10)) # with different colour scale

}

[Package rdwplus version 1.0.0 Index]