Learn R Programming

CSHShydRology (version 1.4.2)

ch_col_gradient: Creates a colour gradient

Description

Creates a colour gradient for plotting.

Usage

ch_col_gradient(
  x,
  colors = c("darkred", "red", "white", "blue", "darkblue"),
  colsteps = 100,
  climits = NULL
)

Value

res

returned array of colour codes

Arguments

x

Vector of values used for gradient.

colors

Vector of colours to form a gradient. Default is `c("darkred", "red","white","blue", "darkblue")`.

colsteps

The number of steps in the gradient. Default is 100.

climits

Sets specific limits for common scaling.

Author

modified by Paul Whitfield

Examples

Run this code
plot(rnorm(20),col='black')

# create a red blue colour gradient for plotting
mycol <- ch_col_gradient(rnorm(20), colsteps = 100)

# plot more random points in transparent blue colour
points(rnorm(20), col = mycol)

Run the code above in your browser using DataLab