[R] Color problem for 2 simple graphs
varin sacha
varinsacha at yahoo.fr
Thu Jan 8 21:06:00 CET 2015
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]]
More information about the R-help
mailing list