William,
Many thanks
It perfectly works.
Best

Envoyé de mon iPhone

Le 8 janv. 2015 à 21:24, William Dunlap <[email protected]> a écrit :

> Supply a vector of colors.  E.g.,
>   barplot(table(mtcars$cyl), col=c("red","yellow","green"))
>   boxplot(with(mtcars, split(wt, cyl)), col=c("red","yellow","green"))
> 
> 
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
> 
> On Thu, Jan 8, 2015 at 12:06 PM, varin sacha <[email protected]> wrote:
>> Hi R-experts,
>> Basic questions (sorry for that) but after many attempts I don't get it. So 
>> in case of you might have time to give me some responses, would be highly 
>> appreciated.
>> Two simple graphs (barplots and boxplots). Everything is going fine but I 
>> would like to have my 2 bars (male and female) or my 2 boxplots (male and 
>> female) in different color, for example male in red and female in darkblue, 
>> I don't get it.
>> Barplots 
>> 
>> Dataset =read.table("/Users/Caro/Desktop/Mesures d'association 
>> usingR/test.txt", header=TRUE, sep="\t", na.strings="NA",dec=".", 
>> strip.white=TRUE) newdata=na.omit(Dataset)
>>  
>> counts <- table(newdata$gender)
>> 
>> barplot(counts, main="Gender",xlab="Gender", col="red") 
>> 
>> 
>>  
>> Boxplots
>> 
>> Dataset =read.table("/Users/Caro/Desktop/Mesures d'association 
>> usingR/test.txt", header=TRUE, sep="\t", na.strings="NA",dec=".", 
>> strip.white=TRUE)
>> 
>> newdata=na.omit(Dataset)boxplot(math.test~gender,data=newdata,main="Gender 
>> and math test", xlab="gender", ylab="math test", col="red")
>> 
>> 
>> 
>> 
>> Best, looking forward to reading you.
>> 
>> 
>> 
>> 
>>  
>> 
>>         [[alternative HTML version deleted]]
>> 
>> ______________________________________________
>> [email protected] mailing list -- To UNSUBSCRIBE and more, see
>> 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.
> 

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
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