[R] Persp and color

ucgamdo@ucl.ac.uk ucgamdo at ucl.ac.uk
Tue Sep 16 12:46:18 CEST 2003


Hi, 

If you run the demo for persp (I have R 1.7), you will see that there is a
good example of 'coluring' a volcano according to different heights, just try

> demo(persp)

and check out the code. You probably will find it too complicated as I did,
I was trying to do the same and honestly I wasn't able to. However, there
is a way around and it is to use the function wireframe from the lattice
package

> library(lattice)
> ?wireframe

If you run through the help examples you'll see that it is a lot easier to
colour the surfaces the way you want using this function. However,
wireframe is extreMELY slow, so, if you have a big matrix it might be a
pain in the behind. Also, the way you feed the data to wireframe is
different to the way you do it with the persp function. I hope this is of
any help.

M.




More information about the R-help mailing list