| text {raster} | R Documentation |
Plots labels, that is a textual (rather than color) representation of values, on top an existing plot (map).
## S4 method for signature 'RasterLayer' text(x, labels, digits=0, fun=NULL, ...) ## S4 method for signature 'RasterStackBrick' text(x, labels, digits=0, fun=NULL, ...) ## S4 method for signature 'SpatialPolygons' text(x, labels, ...) ## S4 method for signature 'SpatialPoints' text(x, labels, ...)
x |
Raster*, SpatialPoints* or SpatialPolygons* object |
labels |
Character. Optional. Vector of labels with |
digits |
Integer. how many digits should be used? |
fun |
Function to subset the values plotted (as in |
... |
Additional arguments to pass to graphics function |
r <- raster(nrows=4, ncols=4)
r <- setValues(r, 1:ncell(r))
plot(r)
text(r)
plot(r, col=bpy.colors(5))
text(r, fun=function(x){x<5 | x>12}, col=c('red', 'white'), vfont=c("sans serif", "bold"), cex=2)