Rolf Turner
2008-Jun-12 04:45 UTC
[R] Panel-specific colours in barchart, lattice package --- thanks.
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}}