How can I control de "wrap-around" color behaviour in the persp function ? I am using something like : persp(bb[1:100,2:97], col= rainbow(8,start=0.1, end=0.8))) Depending on the rainbow length value I get several "wrap-around" blocks of the selected color range...something that I wanted to avoid... My idea is to use the color in order to make a separation from a certain "height" . Where can I find how are the colors ordered ? or can I control the color order ? THanks in advance Marco Marques From Mark mailto:mmarques at power.inescn.pt
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) > ?wireframeIf 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.
Followin Prof. Uwes idea and after checking up some docs I was able to build a color vector with the correct colors and then "call" it from using persp col = option ... Nevertheless I still have a small problem... using something like : colorvect <- rainbow(length(mat3),start=0.1,end=0.8) persp(mat3,col=colorvect, box= FALSE, theta=30) works something like I need... But ... if I try to visualize a specific part like mat3[1:900,2:78] ... persp(mat3[1:900,2:78,col=colorvect, box= FALSE, theta=30) What I get is bleach result with only part of the colors... I know that I were specting this but how can I avoid it with making the colorvect vector each time I call persp ? The other idea is making an equivalent matrix with each cell with the color info... but how can I automate that kind of procedure ? THanks Mark Marques