| gradient.legend | R Documentation | 
Create a gradiented legend
gradient.legend(
  y = NULL,
  yrange = NULL,
  cols = c("red", "blue"),
  location = c(0.075, 0.3, 0.575, 0.975),
  n = 100,
  ...
)
y | 
 the variable used to create the gradient, typically in   | 
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   | 
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  | 
Dustin Fife
number.to.colors colorRampPalette
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="")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.