Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.colourmap

Plot a Colour Map


Description

Displays a colour map as a colour ribbon

Usage

## S3 method for class 'colourmap'
plot(x, ...,
       main, xlim = NULL, ylim = NULL, vertical = FALSE, axis = TRUE,
       labelmap=NULL, gap=0.25, add=FALSE, increasing=NULL)

Arguments

x

Colour map to be plotted. An object of class "colourmap".

...

Graphical arguments passed to image.default or axis.

main

Main title for plot. A character string.

xlim

Optional range of x values for the location of the colour ribbon.

ylim

Optional range of y values for the location of the colour ribbon.

vertical

Logical flag determining whether the colour ribbon is plotted as a horizontal strip (FALSE) or a vertical strip (TRUE).

axis

Logical flag determining whether an axis should be plotted showing the numerical values that are mapped to the colours.

labelmap

Function. If this is present, then the labels on the plot, which indicate the input values corresponding to particular colours, will be transformed by labelmap before being displayed on the plot. Typically used to simplify or shorten the labels on the plot.

gap

Distance between separate blocks of colour, as a fraction of the width of one block, if the colourmap is discrete.

add

Logical value indicating whether to add the colourmap to the existing plot (add=TRUE), or to start a new plot (add=FALSE, the default).

increasing

Logical value indicating whether to display the colour map in increasing order. See Details.

Details

This is the plot method for the class "colourmap". An object of this class (created by the function colourmap) represents a colour map or colour lookup table associating colours with each data value.

The command plot.colourmap displays the colour map as a colour ribbon or as a colour legend (a sequence of blocks of colour). This plot can be useful on its own to inspect the colour map.

If the domain of the colourmap is an interval of real numbers, the colourmap is displayed as a continuous ribbon of colour. If the domain of the colourmap is a finite set of inputs, the colours are displayed as separate blocks of colour. The separation between blocks is equal to gap times the width of one block.

To annotate an existing plot with an explanatory colour ribbon or colour legend, specify add=TRUE and use the arguments xlim and/or ylim to control the physical position of the ribbon on the plot.

Labels explaining the colour map are drawn by axis and can be modified by specifying arguments that will be passed to this function.

The argument increasing indicates whether the colourmap should be displayed so that the input values are increasing with the spatial coordinate: that is, increasing from left to right (if vertical=FALSE) or increasing from bottom to top (if vertical=TRUE). If increasing=FALSE, this ordering will be reversed. The default is increasing=TRUE in all cases except when vertical=TRUE and the domain of the colourmap is a finite set of discrete inputs.

Value

None.

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also

Examples

co <- colourmap(rainbow(100), breaks=seq(-1,1,length=101))
  plot(co)
  plot(co, col.ticks="pink")
  ca <- colourmap(rainbow(8), inputs=letters[1:8])
  plot(ca, vertical=TRUE)

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.