Learn R Programming

spatstat.geom (version 3.7-3)

plot.symbolmap: Plot a Graphics Symbol Map

Description

Plot a representation of a graphics symbol map, similar to a plot legend.

Usage

# S3 method for symbolmap
plot(x, ..., main, xlim = NULL, ylim = NULL,
                         vertical = FALSE,
                         side = c("bottom", "left", "top", "right"),
                         annotate = TRUE, labelmap = NULL,
                         add = FALSE, do.plot=TRUE, 
                         nsymbols = NULL, warn = TRUE,
                         colour.only=FALSE,
                         representatives=NULL)

Arguments

Value

(Invisibly) The symbolmap x with an attribute "bbox"

which is a rectangular window (object of class "owin") giving the region in coordinate space where the symbol map was plotted (or would have been plotted).

Details

A graphics symbol map (object of class "symbolmap") is an association between data values and graphical symbols.

This command plots the graphics symbol map itself, in the style of a plot legend.

For a map of continuous values (a symbol map which represents a range of numerical values) the plot will select about nsymbols different values within this range, and plot their graphical representations.

For a map of discrete inputs (a symbol map which represents a finite set of elements, such as categorical values) the plot will try to display the graphical representation of every possible input, up to a maximum of nsymbols items. If there are more than nsymbols possible inputs, a warning will be issued (if warn=TRUE, the default).

See Also

symbolmap to create a symbol map.

invoke.symbolmap to apply the symbol map to some data and plot the resulting symbols.

Examples

Run this code
  g <- symbolmap(inputs=letters[1:10], pch=11:20)
  plot(g)

  ## squares and circles with area proportional to |x|
  ## For 'squares', size is side length; size = sqrt(area)
  ## For 'circles', size is diameter;    size = sqrt(area * 4/pi)
  g2 <- symbolmap(range=c(-1,1),
                  shape=function(x) ifelse(x > 0, "circles", "squares"),
                  size=function(x) ifelse(x > 0,
                                          sqrt(abs(x)*4/pi),
                                          sqrt(abs(x))),
                  bg = function(x) ifelse(abs(x) < 1, "red", "black"))
  plot(g2, vertical=TRUE, side="left", col.axis="blue", cex.axis=2)
  plot(g2, representatives=c(-1,0,1))

  ## logarithmic display scale
  gl <- symbolmap(range=c(1,1000), pch=21,
                  bg=function(x) ifelse(x < 50, "red", "blue"),
                  cex=function(x) ifelse(x < 100, 1, 2),
                  compress=log10)
  gl(10)
  plot(gl, nsymbols=4)

  ## logarithmic symbol map
  gll <- symbolmap(range=c(1,1000),
                   transform=log10, size=function(x) { 1 + x },
                   compress=log10)
  gll(10)
  plot(gll, nsymbols=4)

Run the code above in your browser using DataLab