[R] can you help me please :)

Stefan Grosse singularitaet at gmx.net
Thu May 28 18:40:00 CEST 2009


On Thu, 28 May 2009 15:47:18 +0300 NOUF AL NUMAIR
<noufalnumair at hotmail.com> wrote:

NAN>  barplot(zz,width = 4,names.arg= xx,axes = TRUE, axisnames = TRUE,
NAN> main=title,xlab=xlab,ylab=ylab,ylim=c(0,1175),xlim=c(0,226),col =
NAN> c(for (i in zz){if i>70 col= "lightblue" else col= "mistyrose"))
NAN> 
NAN> 
NAN> i tried to get red of zero then plot it 

? I have no idea what this means...

NAN> i want to color different result with different colors ?
NAN> 
NAN> any body can help pleeeeaaaaaaasssseee

If you want help try to be more clear about what you want. It is hard
with your mail because there is so much what does not belong to your
current problem, one has to scroll over plenty of numbers and still I am
not sure whether I understood what you want.

Hence you want your bar color conditional on the value or the height,
it is helpful to create a vector beforehand.(for control purposes)

y<-c(1175,  483,  240,  170,   99,   79,   76,   45,   38,   35,
21,   16,   14,   19,   16) 
x<-c( 1,   2,   3,   4,   5,   6,   7,
8,   9,  10,  11,  12,  13,  14,  15) 

d1<-data.frame(x=x,y=y)

Color<-ifelse(d1$y<70,"blue","red")

barplot(as.matrix(d1$y),names.arg=d1$x,col=Color,beside=T)

as an example.

hth
Stefan




More information about the R-help mailing list