Thanks Duncan (and David). I couldn't get back to my computer until today. I understand it pretty well now and I'm able to get what I need.

On a side note, I have had a hard time getting rgl to work. For the moment, I have to compile without libpng and ftfonts, and when I load the package I get an error related to OpenGL (from memory, something like "no GLX extension found"). I'll write more as soon as I'm able.

Regards,
Marc Chiarini

Duncan Murdoch wrote:
On 22/11/2009 1:07 AM, Marc Chiarini (Tufts) wrote:
Dear R Community:

Recently, I have managed to plot some really useful graphs of my research data using persp(). I have even figured out how to overplot rectangular regions (corresponding to submatrices) with a different color. This is accomplished by using par(new=T). I am now searching for a way to "highlight" a set of (possibly non-contiguous) facets with a specific color, e.g., the facet between each set of four points whose values are all above a certain threshold. An example would be coloring the raised corners of the classic sombrero (found in example(persp)) differently from the rest of the sombrero. I feel like the last example in persp() is pointing me in the right direction, but I'm not quite getting it. Any help is much appreciated.

Think of the facets as an nx-1 by ny-1 matrix. Pass the col arg by creating a matrix of this shape. (A vector version of the data in the matrix would also be good enough.)

If you pass something shorter, it will be recycled to that length.

You could also use persp3d from the rgl package, but an important difference is that it colours all nx by ny vertices, and interpolates colours on the facets. So you can't use the same colour matrix as in persp.

Duncan Murdoch
______________________________________________
R-help@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.

Reply via email to