Re: [R] Panel-specific colours in barchart, lattice package --- thanks.

From: Rolf Turner <r.turner_at_auckland.ac.nz>
Date: Thu, 12 Jun 2008 16:45:36 +1200

On 12/06/2008, at 4:08 PM, Martin Morgan wrote:

> I think this works -- 'custom' variables get sent to the panel
> function, where they're picked up and used for making garish plots.
>
> barchart(y ~ x | f, data=X,
> mycolors=rainbow(length(levels(X$f))),
> panel=function(..., mycolors) {
> col <- mycolors[panel.number()]
> panel.barchart(..., col=col)
> })

Yew bewdy!!! Works like a charm. Thanks very much.

(I had ***tried*** using panel.number() --- but didn't get the syntax right, got error messages, and gave up. Oh me of little faith!)

Thanks also to Gabor Grothendieck who came up with a slightly less elaborate version of Martin's idea.

        cheers,

                Rolf

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

R-help_at_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. Received on Thu 12 Jun 2008 - 06:20:06 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 12 Jun 2008 - 06:30:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive