Learn R Programming

terra (version 1.7-55)

density: Density plot

Description

Create density plots of the cell values of a SpatRaster

Usage

# S4 method for SpatRaster
density(x, maxcells=100000, plot=TRUE, main, ...)

Value

density plot (and a density object, returned invisibly if plot=TRUE)

Arguments

x

SpatRaster

maxcells

the maximum number of (randomly sampled) cells to be used for creating the plot

plot

if TRUE produce a plot, else return a density object

main

character. Caption of plot(s)

...

additional arguments passed to plot

Examples

Run this code
logo <- rast(system.file("ex/logo.tif", package="terra"))
density(logo)

Run the code above in your browser using DataLab