[R] Colour gradients and colour fill between points

Richard Müller mueller.eisborn at googlemail.com
Mon Aug 20 16:01:12 CEST 2012


Hello,
Can somebody help me on a colour question?
I have a levelplot made with the following syntax:

library(lattice)
inp <- read.csv("hoenne1", header = TRUE)
levelplot(z~x*y, data = inp, region = TRUE, pretty = TRUE, col.regions
= terrain.colours)

The file "hoenne1" contains the data. I'll give a short example:
x,y,z
0,0,1
0,1,1
0,2,1
1,0,2
1,2,2
0,2,2
1,2,3
2,2,2

You see that data point 1,1 is missing. My script therefore produces
an "empty" field.
I want the following: the colours should be distributed as
interpolating gradients. The empty hole in the middle should get the
colour for z = 2 because that's the result when interpolating. Also
the rest of the graph should be produced by interpolating, i.e.
between 0,0 and 0,1 (z=1 resp. z=2) should be the colour for z = 1.5,
so that a really smooth gradient is achieved. Is that possible?


Thanks for helping, Richard

-- 
Richard Müller . Am Spring 9 . D-58802 Balve
www.oeko-sorpe.de



More information about the R-help mailing list