display | R Documentation |
This function displays a 2D greyscale or RGB colour image. It is a wrapper
around image
, with more sensible defaults for images. It is (S3)
generic. A method for 3D arrays is provided, which assumes that the third
dimension corresponds to channel (grey/alpha for two channels, red/green/
blue for three, red/green/blue/alpha for four).
display(x, ...) ## Default S3 method: display(x, transpose = TRUE, useRaster = TRUE, add = FALSE, col = grey(0:255/255), ...) ## S3 method for class 'matrix' display(x, ...) ## S3 method for class 'array' display(x, max = NULL, ...)
x |
An R object. For the default method, it must be coercible to a numeric matrix. |
... |
Additional arguments to |
transpose |
Whether to transpose the matrix before display. This is
usually necessary due to the conventions of |
useRaster |
Whether to use raster graphics if possible. This is
generally preferred for speed. Passed to |
add |
Whether to add the image to an existing plot. If |
col |
The colour scale to use. The default is 256 grey levels. The array method overrides this appropriately. |
max |
The maximum colour value for each channel. If |
Relative to the defaults for image
(from the graphics
package), this function transposes and then inverts the matrix along the
y-direction, uses a grey colour scale, fills the entire device with the
image, and tries to size the image correctly given the dot pitch of the
display. Unfortunately the latter is not always possible, due to downstream
limitations.
If x
has attributes "range"
, "background"
, "asp"
or "dpi"
, these are respected.
This function is called for its side-effect of displaying an image on a new R device.
Jon Clayden <code@clayden.org>
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.