plot.raster {graphics}R Documentation

Plotting Raster Images

Description

This functions implements a plot method for raster images.

Usage

## 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

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)

[Package graphics version 3.5.0 Index]