gradient.legend: Create a gradiented legend

gradient.legendR Documentation

Create a gradiented legend

Description

Create a gradiented legend

Usage

gradient.legend(
  y = NULL,
  yrange = NULL,
  cols = c("red", "blue"),
  location = c(0.075, 0.3, 0.575, 0.975),
  n = 100,
  ...
)

Arguments

y

the variable used to create the gradient, typically in number.to.colors

yrange

The range of y values. If y is supplied, it will pulls these from the actual y values.

cols

The color gradients to be used that are passed to colorRampPalette.

location

The location of the subplot, expressed in fractions of the entire plot (left x, right x, bottom y, top y).

n

the number of values used for the gradient. Higher numbers make a higher resolution

...

other arguments passed to image

Author(s)

Dustin Fife

See Also

number.to.colors colorRampPalette

Examples

y = rnorm(100); x = .6*y + rnorm(100,0,sqrt(1-.6^2))
randnum = runif(100)
plot(x,y, col=number.to.colors(randnum), pch=16)
gradient.legend(randnum, xlab="", ylab="")

Jorisvansteenbrugge/TcT documentation built on Sept. 26, 2022, 6:50 a.m.