Re: [R] creating rainbow gradients

2008-09-18 Thread Carl Witthoft
quote: From: Gillian Silver Date: Wed, 17 Sep 2008 14:11:39 -0700 What would I do if I have something like: x <- rnorm(1:1000) y <- rnorm(1:1000) z <- x + y and I want the rainbow to increase with z? (i.e., red for lowest z...all the way up to the last color in the rainbow for the highest z)

Re: [R] creating rainbow gradients

2008-09-18 Thread Jim Lemon
Gillian Silver wrote: Hi, how can I create a rainbow gradient in R? For example, let's say I have a plot of y = x...and I want the plot to go from red -> orange -> yellow -> green -> blue -> etc. Right now, I know how to do something like go from red to blue, using the plotrix library: library(p

Re: [R] creating rainbow gradients

2008-09-17 Thread Duncan Murdoch
On 17/09/2008 4:58 PM, Gillian Silver wrote: Hi, how can I create a rainbow gradient in R? For example, let's say I have a plot of y = x...and I want the plot to go from red -> orange -> yellow -> green -> blue -> etc. Right now, I know how to do something like go from red to blue, using the plot

Re: [R] creating rainbow gradients

2008-09-17 Thread hadley wickham
On Wed, Sep 17, 2008 at 3:58 PM, Gillian Silver <[EMAIL PROTECTED]> wrote: > Hi, how can I create a rainbow gradient in R? For example, let's say I have > a plot of y = x...and I want the plot to go from red -> orange -> yellow -> > green -> blue -> etc. Why would you want to? See http://epub.wu-

Re: [R] creating rainbow gradients

2008-09-17 Thread Kingsford Jones
On second thought, this is more likely to be what you're looking for... library(rgl) x <- rnorm(1000) y <- rnorm(1000) z <- x + y plot3d(x, y, z, col = rainbow(1000, end = 5/6)[rank(z)], size = 3) On Wed, Sep 17, 2008 at 4:06 PM, Kingsford Jones <[EMAIL PROTECTED]> wrote: > On Wed, Sep 17, 2008

Re: [R] creating rainbow gradients

2008-09-17 Thread Kingsford Jones
On Wed, Sep 17, 2008 at 3:11 PM, Gillian Silver <[EMAIL PROTECTED]> wrote: > What would I do if I have something like: > > x <- rnorm(1:1000) > y <- rnorm(1:1000) > z <- x + y > > and I want the rainbow to increase with z? (i.e., red for lowest z...all the > way up to the last color in the rainbow

Re: [R] creating rainbow gradients

2008-09-17 Thread Gillian Silver
What would I do if I have something like: x <- rnorm(1:1000) y <- rnorm(1:1000) z <- x + y and I want the rainbow to increase with z? (i.e., red for lowest z...all the way up to the last color in the rainbow for the highest z) On Wed, Sep 17, 2008 at 2:05 PM, stephen sefick <[EMAIL PROTECTED]> w

Re: [R] creating rainbow gradients

2008-09-17 Thread Jorge Ivan Velez
Dear Gillian, See ?rainbow and its example. HTH, Jorge On Wed, Sep 17, 2008 at 4:58 PM, Gillian Silver <[EMAIL PROTECTED]>wrote: > Hi, how can I create a rainbow gradient in R? For example, let's say I have > a plot of y = x...and I want the plot to go from red -> orange -> yellow -> > green

Re: [R] creating rainbow gradients

2008-09-17 Thread stephen sefick
plot(1:20, col=rainbow(20)) On Wed, Sep 17, 2008 at 4:58 PM, Gillian Silver <[EMAIL PROTECTED]> wrote: > Hi, how can I create a rainbow gradient in R? For example, let's say I have > a plot of y = x...and I want the plot to go from red -> orange -> yellow -> > green -> blue -> etc. > Right now, I

[R] creating rainbow gradients

2008-09-17 Thread Gillian Silver
Hi, how can I create a rainbow gradient in R? For example, let's say I have a plot of y = x...and I want the plot to go from red -> orange -> yellow -> green -> blue -> etc. Right now, I know how to do something like go from red to blue, using the plotrix library: library(plotrix) redToBlue <- col