[R] wireframe shade=T colorkey
deepayan.sarkar at gmail.com
Fri Oct 12 22:17:53 CEST 2007
On 10/12/07, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> On 10/11/2007 6:32 PM, Deepayan Sarkar wrote:
> > On 10/11/07, Karim Rahim <karim.rahim at gmail.com> wrote:
> >> 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?
> > I'm not really sure what you want. The goal of the colorkey is to
> > associate a given z-value (or height) with a specific color.
> > drape=TRUE does this, e.g.,
> > wireframe(volcano, drape = TRUE, colorkey = TRUE)
> > Now, with shade=TRUE, e.g.,
> > wireframe(volcano, shade = TRUE)
> > the SAME Z-VALUE CAN HAVE DIFFERENT COLORS depending on the
> > orientation of the facet with respect to the viewing direction and the
> > light source. So, a colorkey DOES NOT MAKE SENSE.
> But the colorkey could display what the color would be at some
> particular orientation, with height allowed to vary, or perhaps with
> fixed values for irradiance and reflective angle. With the standard
> palette this should be readable because the height determines the hue,
> and (non-colorblind) people are good at recognizing hue even when
> saturation and brightness vary.
Yes, and since it's easy to specify your own colors and breakpoints,
you could do
shade.col.fun <- trellis.par.get("shade.colors")$palette
shade.colors <- shade.col.fun(0.5, 0.5, seq(0, 1, length = 100))
wireframe(volcano, shade = TRUE,
colorkey = list(col = shade.colors,
at = do.breaks(range(volcano), 100)))
While this works for the standard color palette, it doesn't do
anything useful for the standard black and white palette, which
ignores height. Given the lack of generality, I would be reluctant to
have something this happen automatically.
More information about the R-help