
Last chance! 50% off unlimited learning
Sale ends in
rescale(x, xlow, xhigh, rlow=0, rhigh=1, clip=TRUE)
x
value to correspond to rlow
. If not given, it will be
calculated as the minimum value of x
x
value to correspond to rhigh
. If not given, it will be
calculated as the maximum value of x
x
equal to xlow
.x
equal to xhigh
.TRUE
to clip the result to the range rlow
to rhigh
.lim[1]
and maximum lim[2]
.x <- runif(1000, min=-1, max=1)
y <- runif(1000, min=-1, max=1)
drawPalette(zlim=c(0,2), zlab=expression(x^2+y^2), col=oceColorsJet)
col <- oceColorsJet(256)[rescale(x^2+y^2, rlow=1, rhigh=256)]
plot(x, y, col=col, cex=4, pch=20)
Run the code above in your browser using DataLab