Learn R Programming

osmplotr (version 0.1-2)

colour_mat: colour_mat

Description

Generates a 2D matrix of graduated colours.

Usage

colour_mat(n = c(10, 10), cols = NULL, rotate = NULL, plot = FALSE)

Arguments

n
number of rows and columns (default = 10; if length 2, then dimensions of rectangle).
cols
vector of length >= 4 of colors (example, default = rainbow (4), or from RColorBrewer, brewer.pal (4, 'Set1')). cols are wrapped clockwise around the corners from top left to bottom left.
rotate
rotates the entire colour matrix by the specified angle (in degrees).
plot
plots the colour matrix (default FALSE)

Value

  • matrix of colours

Examples

Run this code
library (osmplotr)
cm <- colour_mat (n=20, cols=rainbow(4), rotate=90, plot=TRUE)

Run the code above in your browser using DataLab