Bar plot of a RasterLayer
Create a barplot of the values of a RasterLayer. For large datasets a regular sample with a size of approximately maxpixels
is used.
methods
## S4 method for signature 'RasterLayer' barplot(height, maxpixels=1000000, digits=0, breaks=NULL, col=rainbow, ...)
height
: RasterLayermaxpixels
: integer. To regularly subsample very large objectsdigits
: integer used to determine how to round
the values before tabulating. Set to NULL
or to a large number if you do not want any roundingbreaks
: breaks used to group the data as in cut
col
: a color generating function such as rainbow
, or a vector of colors...
: additional arguments for plotting as in barplot
hist, boxplot
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("external/test.grd", package="raster") r <- raster(f) barplot(r, digits=-2, 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)