[R] How do I change the colour and format for the trelli plot ?
David Winsemius
dwinsemius at comcast.net
Fri Nov 20 00:30:19 CET 2009
On Nov 19, 2009, at 3:10 PM, ychu066 wrote:
>
> I want to change the colour of the histogram in each panel by the
> levels of
> the conoditonal factor.
>
> I have 3 levels in the factor
>
> levels(data[,2])[1]
> levels(data[,2])[2]
> levels(data[,2])[3]
>
> what can i do , in order to chnage the colour ??
Why do you suppose there is a FAQ?
Assuming that the underlying levels are coercible to numeric type then:
col = as.numeric(as.character(data[ , 2] ) )
and of course:
library(fortunes)
fortune("dog")
-- David
>
>
>
> ychu066 wrote:
>>
>> Fore example my code is
>> histogram(~data[,8]|data[,2], ylab = "Frequency", xlab = "Score",
>> xlim =
>> c(1,5), ylim = c(0,100),layout = c(3,1),col=data[,2] )
>>
>> and i want the colour to be depended on the level of the factor in
>> data[,2]. how do i do that ?
>>
>>
>>
>>
>>
>> ychu066 wrote:
>>>
>>> what is that ?
>>>
>>>
>>>
>>> Hrishi Mittal wrote:
>>>>
>>>> Add col=i in the histogram call.
>>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/How-do-I-change-the-colour-and-format-for-the-trelli-plot---tp26418382p26421465.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list