Plot a Pixel Image
Plot a pixel image.
## S3 method for class 'im': plot(x, \dots, col=NULL, valuesAreColours=NULL, ribbon=TRUE, ribsep=0.15, ribwid=0.05, ribn=1024, ribscale=1)
- The pixel image to be plotted.
An object of class
- Extra arguments passed to
imageto control the plot.
- Colours for displaying the pixel values.
Either a character vector of colour values,
or an object of class
- Logical value. If
TRUE, the pixel values of
xare to be interpreted as colour values.
- Logical flag indicating whether to display a ribbon showing the colour map.
- Factor controlling the space between the ribbon and the image.
- Factor controlling the width of the ribbon.
- Number of different values to display in the ribbon.
- Rescaling factor for tick marks. The values on the numerical scale printed beside the ribbon will be multiplied by this rescaling factor.
This is the
plot method for the class
[It is also the
image method for
The pixel image
x is displayed on the current plot device,
using equal scales on the
ribbon=TRUE, a legend will be plotted at the right of the
image. The legend consists of a colour ribbon and an axis with tick-marks,
showing the correspondence between the pixel values and the colour map.
ribsep, ribwid, ribn control the appearance of the
The width of the ribbon is
ribwid times the size of the pixel
image, where `size' means the larger of the width and the height.
The distance separating the ribbon and the image is
the size of the pixel image. The ribbon contains
different numerical values, evenly spaced between the minimum and
maximum pixel values in the image
x, rendered according to
the chosen colour map.
Normally the pixel values are displayed using the colours given in the
col. This may be either an explicit colour map
(an object of class
"colourmap", created by the function
colourmap) or a character vector or integer vector
that specifies a set of colours.
col is an explicit colour map
(an object of class
"colourmap") then the same colour
always represents the same numeric value. For example this ensures
that when we plot different images, the colour maps are consistent.
col is a character vector or integer vector that specifies
colours, then the colour mapping will be stretched to match the range of
pixel values in the image
x. In this case, the mapping of pixel values
to colours is determined as follows.
[object Object],[object Object],[object Object]
Other graphical parameters controlling the display of both the pixel image
and the ribbon are passed through the
directly to the function
Alternatively, the pixel values could be directly interpretable as colour values in R. That is, the pixel values could be character strings that represent colours, or values of a factor whose levels are character strings representing colours.
valuesAreColours=TRUE, then the pixel values will be interpreted as colour values and displayed using these colours.
valuesAreColours=FALSE, then the pixel values willnotbe interpreted as colour values, even if they could be.
valuesAreColours=NULL, the algorithm will guess what it should do. If the argument
colis given, the pixel values willnotbe interpreted as colour values. Otherwise, if all the pixel values are strings that represent colours, then they will be interpreted and displayed as colours.
ribbonwill be ignored, and a ribbon will not be plotted. To suppress the axis tick marks and labels, set
# an image Z <- setcov(owin()) plot(Z) # stretchable colour map plot(Z, col=terrain.colors(128), axes=FALSE) # fixed colour map tc <- colourmap(rainbow(128), breaks=seq(-1,2,length=129)) plot(Z, col=tc)