You can use
plot(y~x,col=color.index.in.palette.defined.from(z),pch=20,type="p")
where
color.index.in.palette.defined.from(z)
is a function or an expression, returning either a color index in a
predefined palette or any other color representation, suitable for R. This
is described in ?par.
I have successfuly used col=z*10 with your sample data.
type="p" specifies, that points will be plotted.
pch=20 says to plot them as small filled circles, sometimes I needed smaller
circles, and pch=183 worked for me.
The package fields and several other packages related to the spatial
statistics are able to plot irregularly distributed point data and
interpolate them to a regular grid (produce a 'contiguous' map).
Here are some links:
http://sal.uiuc.edu/csiss/Rgeo/
http://r-spatial.sourceforge.net/
You can also try
RSiteSearch("spatial")
or
help.search("spatial")
from the R console
Trevor Graham wrote:>
> I've got some data in a data frame arranged like this:
> x y z othervariables ....
> 0.1 0.2 1.7 0.01 ....
> 0.2 0.2 1.3 0.23 ....
> 0.2 0.3 1.1 0.43 ....
> etc
>
> I'd like to plot a heatmap of this data, with x and y as the (x,y)
coords
> and z defining the colour at each point.
>
> I'm having difficulty finding the correct functions to use. Can anyone
> make any recommendations?
>
> It seems straightforward to make the plot using the image function if
> the data is in matrix form, but I'm not sure how to transform my xyz
> data into matrix form.
>
>
--
View this message in context:
http://www.nabble.com/-R--heatmap-from-xyz-data-tf3180966.html#a8827597
Sent from the R help mailing list archive at Nabble.com.