[R] image plot but data not on grid.

Martyn Byng Martyn.Byng at nag.co.uk
Fri Aug 6 16:42:02 CEST 2010


Hi,

Not really sure what you are after, but the following plots a series of
points of varying colour

plot(x,y,type='n')
apply(cbind(x,y,z),1,function(a) {points(a[1],a[2],col=a[3],pch=".")})

but its going to be really slow for a large number of points

Martyn

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of W Eryk Wolski
Sent: 06 August 2010 15:25
To: r-help at r-project.org
Subject: [R] image plot but data not on grid.

Hi,

Would like to make an image
however the values in z are not on an uniform grid.

Have a dataset with
length(x) == length(y) == length(z)
x[1],y[1] gives the position of z[1]

and would like to encode value of z by a color.

looking for something like
plot(x,y, col = z)
where col for z is cleverly chosen from a colorscale.

Hope I made clear what I am looking for.

Thanks
Eryk

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

________________________________________________________________________
This e-mail has been scanned for all viruses by Star.\ _...{{dropped:12}}



More information about the R-help mailing list