[R] stacked barplot colour coding

acacia21 chrissu21 at hotmail.com
Tue Jan 10 02:01:28 CET 2012


Hi all,
i'm fairly new to R and its graphing, but having unsuccessfully  'googled'
and checked this forum to find answer to my problem, i'm posting my question
here.

I'm trying to plot stacked barplot. I have simple data that looks like this:
bg	         ag
0.41	2.81
0.37	2.91
0.31	2.06
0.32	2.39

every row indicates a factor (1,2,3,4, see below in names.arg). Now when i
plot this using following function for stacked barplots:
plot<-barplot(t(data), main=txt, ylim=c(0,10), col=c("white", "grey90"),
ylab="Total biomass (g)", space=0.1, names.arg=c("1", "2", "3", "4")) 
 
i get a lovely stacked graph and it color-codes with white (bg) and grey90
(ag) in each individual stacked bar.  I have a total of 4 stacked bars as i
have 4 factors. Now here is the question: i would like to add density lines
across entire stacked bar or any other graphic feature to distinguish
between bars 1 and 2 as they indicate same factor and  3 and 4 that indicate
different factor. Is there any way to do that? Surely it's possible, but not
so obvious for the beginner =)

thank you very much


--
View this message in context: http://r.789695.n4.nabble.com/stacked-barplot-colour-coding-tp4280685p4280685.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list