Learn R Programming

spatstat (version 1.48-0)

textureplot: Plot Image or Tessellation Using Texture Fill

Description

For a factor-valued pixel image, this command plots each level of the factor using a different texture. For a tessellation, each tile is plotted using a different texture.

Usage

textureplot(x, ..., main, add=FALSE, clipwin=NULL, do.plot = TRUE, border=NULL, col = NULL, lwd = NULL, lty = NULL, spacing = NULL, textures=1:8, legend=TRUE, leg.side=c("right", "left", "bottom", "top"), legsep=0.1, legwid=0.2)

Arguments

x
A tessellation (object of class "tess" or something acceptable to as.tess) with at most 8 tiles, or a pixel image (object of class "im" or something acceptable to as.im) whose pixel values are a factor with at most 8 levels.
...
Other arguments passed to add.texture.
main
Character string giving a main title for the plot.
add
Logical value indicating whether to draw on the current plot (add=TRUE) or to initialise a new plot (add=FALSE).
clipwin
Optional. A window (object of class "owin"). Only this subset of the image will be displayed.
do.plot
Logical. Whether to actually do the plot.
border
Colour for drawing the boundaries between the different regions. The default (border=NULL) means to use par("fg"). Use border=NA to omit borders.
col
Numeric value or vector giving the colour or colours in which the textures should be plotted.
lwd
Numeric value or vector giving the line width or widths to be used.
lty
Numeric value or vector giving the line type or types to be used.
spacing
Numeric value or vector giving the spacing parameter for the textures.
textures
Textures to be used for each level. Either a texture map (object of class "texturemap") or a vector of integer codes (to be interpreted by add.texture).
legend
Logical. Whether to display an explanatory legend.
leg.side
Position of legend relative to main plot.
legsep
Separation between legend and main plot, as a fraction of the shortest side length of the main plot.
legwid
Width (if vertical) or height (if horizontal) of the legend as a fraction of the shortest side length of the main plot.

Value

(Invisible) A texture map (object of class "texturemap") associating a texture with each level of the factor.

Details

If x is a tessellation, then each tile of the tessellation is plotted and filled with a texture using add.texture.

If x is a factor-valued pixel image, then for each level of the factor, the algorithm finds the region where the image takes this value, and fills the region with a texture using add.texture.

See Also

im, plot.im, add.texture.

Examples

Run this code
  nd <- if(interactive()) 128 else 32
  Z <- setcov(owin(), dimyx=nd)
  Zcut <- cut(Z, 3, labels=c("Lo", "Med", "Hi"))
  textureplot(Zcut)
  textureplot(dirichlet(runifpoint(6)))

Run the code above in your browser using DataLab