Learn R Programming

spatstat.geom (version 3.3-2)

pHcolourmap: Colour Map for pH Values

Description

Create a colour map for values of \(pH\).

Usage

pHcolourmap(range = c(0, 14), ..., n=256, step = FALSE)
 pHcolour(pH)

Value

The return value of pHcolour is a character string or a vector of character strings representing colours.

The return value of pHcolourmap

is a colour map (object of class "colourmap").

Arguments

n

Number of different colour values to be used, when step=FALSE.

range

Range of \(pH\) values that will be accepted as inputs to the colour map. A numeric vector of length 2 giving the minimum and maximum values of \(pH\).

step

Logical value. If step=FALSE (the default) the colours change continuously with increasing values of the input. If step=TRUE, the colour is constant on each unit interval of \(pH\) values.

...

Ignored.

pH

Numerical value or numeric vector of values of \(pH\).

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au.

Details

In chemistry the hydrogen potential \(pH\) measures how acidic or basic a solution is.

The function pHcolour calculates the colour associated with a given value of \(pH\), according to a standard mapping in which neutral \(pH=7\) is green, acidic values \(pH < 7\) are yellow or red, and basic values \(pH > 7\) are blue. The function pHcolour takes a numerical value or vector of values of \(pH\) and returns a character vector containing the corresponding colours.

The function pHcolourmap produces a colour map for numerical values of \(pH\), using the same consistent mapping of \(pH\) values to colours. The argument range specifies the range of \(pH\) values that will be mapped by the resulting colour map. It should be a numeric vector of length 2 giving the minimum and maximum values of \(pH\) that the colour map will handle. (Colour maps created with different values of range use essentially the same mapping of colours, but when plotted as colour ribbons, display only the specified range.)

If step=FALSE (the default) the colours change continuously with increasing values of the input. There will be n different colour values in the colour map. Usually n should be a large number.

If step=TRUE, the colour is constant on each unit interval of \(pH\) values. That is, any value of \(pH\) in the interval \([k, k+1]\), where \(k\) is an integer, will be mapped to the same colour.

See Also

colourmap

Examples

Run this code
  pHcolour(7)

  plot(pHcolourmap())
  plot(pHcolourmap(step=TRUE))
  plot(pHcolourmap(c(3, 8)))

Run the code above in your browser using DataLab