Learn R Programming

IsoriX (version 0.4-1)

isorixpalette: Colour palettes for plotting

Description

These datasets contain colour vectors that can be used for plotting. In our examples, we use the isoscapepalette for plotting the isoscape using plot.isoscape and isorixpalette for plotting the assignment outcoume using plot.isorix.

Usage

data(isoscapepalette) data(isorixpalette)

Arguments

Format

A vector of colours

Source

For information on how to use themes, check: https://oscarperpinan.github.io/rastervis/#themes

Details

Colour palettes can be created by using the function colorRamp that interpolates colours between a set of given colours. One can also use colorRampPalette to create functions providing colours. Also interesting, the function colorspace::choose_palette offers a GUI interface allowing to create and save a palette in a hexadecimal format (which can later on be imported into R). This latter function is however limited to a maximum of 50 colours. You can also use R colour palettes already available such as terrain.colors or others available (see examples below). Alternatively, you can design your own colour palette by writing standard hexadecimal code of colours into a vector.

See Also

rainbow for information about R colour palettes

colorRamp and colorspace::choose_palette to create your own palettes

Examples

Run this code
### A COMPARISON OF SOME COLOUR PALETTES
data(isoscapepalette)
data(isorixpalette)

par(mfrow=c(2, 3))
pie(rep(1, length(isoscapepalette)), col = isoscapepalette,
	border=NA, labels=NA, clockwise=TRUE, main="isoscapepalette")
pie(rep(1, length(isorixpalette)), col = isorixpalette,
	border=NA, labels=NA, clockwise=TRUE, main="isorixpalette")
pie(rep(1, 100), col = terrain.colors(100), border=NA, labels=NA,
    clockwise=TRUE, main="terrain.colors")
pie(rep(1, 100), col = rainbow(100), border=NA, labels=NA,
    clockwise=TRUE, main="rainbow")
pie(rep(1, 100), col = topo.colors(100), border=NA, labels=NA,
    clockwise=TRUE, main="topo.colors")
pie(rep(1, 100), col = heat.colors(100), border=NA, labels=NA,
    clockwise=TRUE, main="heat.colors")

### CREATING YOUR OWN COLOUR PALETTE
my.palette  <- colorRampPalette(c("blue", "green", "red"), bias=0.7)
par(mfrow=c(1, 1))
pie(1:100, col=my.palette(100), border=NA, labels=NA,
    clockwise=TRUE, main="a home-made palette")

Run the code above in your browser using DataLab