[R] colors in lattice histograms
Deepayan Sarkar
deepayan.sarkar at gmail.com
Fri Oct 31 01:11:14 CET 2008
On Thu, Oct 30, 2008 at 4:10 PM, Barker, Chris <Chris.Barker at cvt.com> wrote:
>
>
> I am using the lattice histogram
>
> histogram( ~ base_var | treatment, data=mydataset )
>
> In my dataset, the histogram produces (as expected) two histograms,
> each corresponding to one of the two treatments.
>
> I would like to have the histogram for one treatment to have, say, red
> bars, the histogram for the second treatment, to have blue bars.
>
> I tried the ",col=" option, but that colors individual bars rather than
> the histogram.
Try
histogram(~ base_var | treatment, data=mydataset
panel = function(..., col) panel.histogram(..., col = c('red',
'blue')[packet.number()]))
-Deepayan
More information about the R-help
mailing list