[R] wireframe shade=T colorkey

Karim Rahim karim.rahim at gmail.com
Fri Oct 12 00:14:17 CEST 2007

Thank you for your reply.

In this graphics context, I'm not sure what the incident or reflected
light rays are.

May I ask for an example of using a colour key with the volcano data
using the colours that appear when you select the shade option?

It is simple to have the colour key appear using drape. Perhaps it is
not so simple to have a colour key using shade colours or different
colours. Once again, may I ask for an example of setting these colour
key and/or colour options?


On 10/11/07, Deepayan Sarkar <deepayan.sarkar at gmail.com> wrote:
> On 10/10/07, Karim Rahim <karim.rahim at gmail.com> wrote:
> > Hi,
> >
> > I am using wireframe with shade=T and I would like a colour key that
> > matches the colours produced with the option shade=T. How do I do
> > this?
> That's not meaningful, since the colors depend on not only the
> z-value, but also the local gradient. From ?cloud:
> shade.colors.palette: a function (or the name of one) that is supposed
>           to calculate the color of a facet when shading is being used.
>           Three pieces of information are available to the function:
>           first, the cosine of the angle between the incident light ray
>           and the normal to the surface (representing foreshortening);
>           second, the cosine of half the angle between the reflected
>           ray and the viewing direction (useful for non-Lambertian
>           surfaces); and third, the scaled (average) height of that
>           particular facet with respect to the total plot z-axis
>           limits.
>           All three numbers should be between 0 and 1. The
>           'shade.colors.palette' function should return a valid color.
>           The default function is obtained from the trellis settings.
> The default is:
> > trellis.par.get("shade.colors")$palette
> function (irr, ref, height, saturation = 0.9)
> {
>     hsv(h = height, s = 1 - saturation * (1 - (1 - ref)^0.5),
>         v = irr)
> }
> which of course you can use to come up with your own key if you want
> (see the entry for 'legend' in ?xyplot).
> -Deepayan

More information about the R-help mailing list