contour.im
Contour plot of pixel image
Generates a contour plot of a pixel image.
Usage
# S3 method for im
contour(x, …, main,
axes=FALSE, add=FALSE, col=par("fg"),
clipwin=NULL, show.all=!add, do.plot=TRUE)
Arguments
- x
Pixel image to be plotted. An object of class
"im"
.- main
Character string to be displayed as the main title.
- axes
Logical. If
TRUE
, coordinate axes are plotted (with tick marks) around a region slightly larger than the image window. IfFALSE
(the default), no axes are plotted, and a box is drawn tightly around the image window. Ignored ifadd=TRUE
.- add
Logical. If
FALSE
, a new plot is created. IfTRUE
, the contours are drawn over the existing plot.- col
Colour in which to draw the contour lines. Either a single value that can be interpreted as a colour value, or a
colourmap
object.- clipwin
Optional. A window (object of class
"owin"
). Only this subset of the data will be displayed.- …
Other arguments passed to
contour.default
controlling the contour plot; see Details.- show.all
Logical value indicating whether to display all plot elements including the main title, bounding box, and (if
axis=TRUE
) coordinate axis markings. Default isTRUE
for new plots andFALSE
for added plots.- do.plot
Logical value indicating whether to actually perform the plot.
Details
This is a method for the generic contour
function,
for objects of the class "im"
.
An object of class "im"
represents a pixel image;
see im.object
.
This function displays the values of the pixel image x
as a contour plot on the current plot device,
using equal scales on the \(x\) and \(y\) axes.
The appearance of the plot can be modified
using any of the arguments listed in the help for
contour.default
.
Useful ones include:
- nlevels
Number of contour levels to plot.
- drawlabels
Whether to label the contour lines with text.
- col,lty,lwd
Colour, type, and width of contour lines.
See contour.default
for a full list of these arguments.
The defaults for any of the abovementioned arguments
can be reset using spatstat.options("par.contour")
.
If col
is a colour map (object of class "colourmap"
,
see colourmap
) then the contours will be plotted in
different colours as determined by the colour map.
The contour at level z
will be plotted
in the colour col(z)
associated with this level in the colour map.
Value
none.
See Also
Examples
# NOT RUN {
# an image
Z <- setcov(owin())
contour(Z, axes=TRUE)
contour(Z)
co <- colourmap(rainbow(100), range=c(0,1))
contour(Z, col=co, lwd=2)
# }