Bar plot of a SpatRaster
Create a barplot of the values of a the first layer of a SpatRaster. For large datasets a regular sample with a size of approximately maxcells
is used.
## S4 method for signature 'SpatRaster' barplot(height, maxcell=1000000, digits=0, breaks=NULL, col, ...)
height |
SpatRaster |
maxcell |
integer. To regularly subsample very large datasets |
digits |
integer used to determine how to |
breaks |
breaks used to group the data as in |
col |
a color generating function such as |
... |
additional arguments for plotting as in |
A numeric vector (or matrix, when beside = TRUE
) of the coordinates of the bar midpoints, useful for adding to the graph. See barplot
f <- system.file("ex/elev.tif", package="terra") r <- rast(f) barplot(r, digits=-1, las=2, ylab="Frequency") op <- par(no.readonly = TRUE) par(mai = c(1, 2, .5, .5)) barplot(r, breaks=10, col=c("red", "blue"), horiz=TRUE, digits=NULL, las=1) par(op)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.