Plotting Raster Images

Share:

Description

This functions implements a plot method for raster images.

Usage

1
2
3
4
5
## S3 method for class 'raster'
plot(x, y,
     xlim = c(0, ncol(x)), ylim = c(0, nrow(x)),
     xaxs = "i", yaxs = "i",
     asp = 1, add = FALSE, ...)

Arguments

x, y

raster. y will be ignored.

xlim, ylim

Limits on the plot region (default from dimensions of the raster.

xaxs, yaxs

Axis interval calculation style (default means that raster fills plot region.

asp

Aspect ratio (default retains aspect ratio of the raster).

add

Logical indicating whether to simply add raster to an existing plot.

...

Further arguments to the rasterImage function.

See Also

plot.default, rasterImage.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
require(grDevices)
r <- as.raster(c(0.5, 1, 0.5))
plot(r)
# additional arguments to rasterImage()
plot(r, interpolate=FALSE)
# distort
plot(r, asp=NA)
# fill page
op <- par(mar=rep(0, 4))
plot(r, asp=NA)
par(op)
# normal annotations work
plot(r, asp=NA)
box()
title(main="This is my raster")
# add to existing plot
plot(1)
plot(r, add=TRUE)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.