[R] BarPlot Color

From: Mohsen Jafarikia <jafarikia_at_gmail.com>
Date: Tue 17 Oct 2006 - 00:25:26 GMT


Hello everyone,

In the following program, I have specified if 'Q!=0', bar color is 'orange' and if is '0.0', color is green. Now I want to have different colors for 'Q'. For example:

If 'Q=0.0' then color is green
If 'Q=1.92' then color is blue
If 'Q=4.48' then color is red

I also want an indicator in the bottom of the graph which tells me what is every color.

 Can anybody tell me how I can do this?

Thanks,
Mohsen

pdf('Test.pdf')

BL<-c(1.97,8.04,2.54,10.53,4.85,1.73)
LR<-c(0.85,0.86,8.33,04.18,6.26,2.40)
 Q<-c(0.00,0.00,1.92,01.92,4.48,0.00)

cols <- ifelse(Q!=0, "orange", "green")
Graph<- barplot(LR, col=cols, width=(BL)) axis(1)

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch 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. Received on Tue Oct 17 10:37:07 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 17 Oct 2006 - 01:30:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.