Hello

sorry that I did not make the letter clearly stated.

Now I have 21 boxplots (No. 1, No. 2....No. 21 from the left to the
right)(lattice).
I want the first two (No. 1 and 2) to become red and the rest (No. 3 to No.
21) to become blue.
(rep will make No. 1 and 2, No. 9 and 10, No. 17 and 18, No. become red.)

Please kindly advise R-code that can specify the red color for No. 1 and 2,
the blue color for the rest.
Thanks again.

Elaine

On Mon, Feb 25, 2013 at 4:17 AM, Peter Ehlers <ehl...@ucalgary.ca> wrote:

> On 2013-02-24 03:50, Elaine Kuo wrote:
>
>> Hello
>>
>> Thank you for the advice on vector.
>> I found a previous mail on this issue and pasted it below.
>>
>> Now here comes a different scenario.
>> I have more than 20 boxplots and just wanted the first two from the left
>> to
>> be red and the rest to be blue.
>> Please kindly advise how to code the color without writing the color names
>> 18 times.
>> Thanks again.
>>
>> Elaine
>>
>
> [...snip...]
>
> I haven't followed this thread, but is there some reason why you can't
> just use rep()?
>
> Example (from the help page for bwplot):
>
>  mycol <- rep( c("red", "blue"), c(2, 6) )
>  bwplot(voice.part ~ height, data = singer, fill = mycol)
>
> Peter Ehlers
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to