plot.grid | R Documentation |
This function plots a grid object. By default it uses a black and white color gradient.
## S3 method for class 'grid'
plot(x, asp = 1, xlab = "x", ylab = "y",
min.val = min(x$m, na.rm = TRUE), max.val = max(x$m, na.rm = TRUE),
add = FALSE, na.col = NA, use.raster = TRUE, interpolate = FALSE, col,
nramp=200, reverse.col=FALSE, restore.par = TRUE, ..., use.old)
x |
a |
asp |
the aspect ratio of the plot. |
min.val, max.val |
The minimum and maximum values used for converting the values in the grid to the
colors. Defaults to the minumum and maximum value in the grid. Only relevant
when |
add |
If |
na.col |
The color to be used to plot NA values. By default they are left
as NA which is plotted as transparent on most devices. This is only used when
|
use.raster |
If |
interpolate |
This determines whether linear interpolation is used. The effect of changing this argument will be most evident when the number of cells plotted in the grid is much smaller than the pixel resolution of the graphics device; under those conditions turning interpolation on will tend to smooth the original cells in the grid. This is only used by the new version of the function. |
col |
A vector of colors to be used to plot values of the grid. If |
nramp |
The number of distinct colors to be used when plotting. The default color
palette or the palette specified by |
reverse.col |
If |
restore.par |
If |
... |
Other arguments to |
xlab, ylab |
the label for the x and y axes. (Only used if |
use.old |
Depreciated. use.old = TRUE has the same effect as use.raster = FALSE. |
This is a convenience wrapper for either rasterImage
or image
. By default it causes the grid to be plotted with a 1:1 aspect ratio and a grayscale color ramp.
Nothing is returned.
When use.raster
is TRUE
this function uses rasterImage
this is a much better way of plotting rasters than the older
image
function. However, it fails on remote desktop connections
in Windows under the default configuration. To configure remote desktop so
that this function will work follow directions here:
http://r.789695.n4.nabble.com/R-base-package-grid-does-not-output-raster-image-td4672188.html
Ethan Plunkett
grid
g <- dem
# Plot
plot(g)
plot(g, na.col="yellow")
plot(g, use.raster = FALSE) # may work better on some devices
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.