Skip to content
Prev 273134 / 398506 Next

Scatterplot with the 3rd dimension = color?

On 11-10-02 1:11 PM, Kerry wrote:
It's not a particularly effective display, but here's how to do it.  Use 
rainbow(101) in place of rev(heat.colors(101)) if you like.

x <- rnorm(10)
y <- rnorm(10)
z <- rnorm(10)
colors <- rev(heat.colors(101))
zcolor <- colors[(z - min(z))/diff(range(z))*100 + 1]
plot(x,y,col=zcolor)

Duncan Murdoch