I'm trying to use multiple plotting colors in my code. My first "ifelse" statement successfully does what I want. However, now I want anything less than -4.5 to be green and the rest black. I want another "col" argument but can only use one. How could I go about getting separate colors for anything above 4.5 and less than -4.5? plot(three, type="h", col=ifelse(three > 4.5, "red", "black"), xlim=c(0,500), ylim=range(three), lwd=2, xlab="Chromosome", ylab="Z-Score", font.lab=2, font=2, main="Upregulated Genes in Patient Sample") Thanks in advance, Patrick The information transmitted is intended only for the per...{{dropped:10}}
Richardson, Patrick <Patrick.Richardson <at> vai.org> writes:> > I'm trying to use multiple plotting colors in my code. My first "ifelse"statement successfully does what I> want. However, now I want anything less than -4.5 to be green and the restblack. I want another "col"> argument but can only use one. How could I go about getting separate colorsfor anything above 4.5 and less> than -4.5? > > plot(three, type="h", col=ifelse(three > 4.5, "red", "black"), xlim=c(0,500),ylim=range(three), lwd=2,> xlab="Chromosome", ylab="Z-Score", font.lab=2, font=2, main="UpregulatedGenes in Patient Sample")> > Thanks in advance, > > Patrick > > The information transmitted is intended only for the p...{{dropped:22}}
Hi, On Mon, Jul 12, 2010 at 12:02 PM, Richardson, Patrick <Patrick.Richardson at vai.org> wrote:> I'm trying to use multiple plotting colors in my code. My first "ifelse" statement successfully does what I want. However, now I want anything less than -4.5 to be green and the rest black. I want another "col" argument but can only use one. How could I go about getting separate colors for anything above 4.5 ?and less than -4.5? > > plot(three, type="h", col=ifelse(three > 4.5, "red", "black"), xlim=c(0,500), ylim=range(three), lwd=2, > ? ? xlab="Chromosome", ylab="Z-Score", font.lab=2, font=2, main="Upregulated Genes in Patient Sample")How about: my.colors <- ifelse(three > 4.5, "red", "black") my.colors[three < -4.5] <- 'green' plot(three, type='h', col=my.colors, ...) -- Steve Lianoglou Graduate Student: Computational Systems Biology ?| Memorial Sloan-Kettering Cancer Center ?| Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
Richardson, Patrick <Patrick.Richardson <at> vai.org> writes:> > I'm trying to use multiple plotting colors in my code. My first "ifelse"statement successfully does what I> want. However, now I want anything less than -4.5 to be green and the restblack. I want another "col"> argument but can only use one. How could I go about getting separate colorsfor anything above 4.5 and less> than -4.5? > > plot(three, type="h", col=ifelse(three > 4.5, "red", "black"), xlim=c(0,500),ylim=range(three), lwd=2,> xlab="Chromosome", ylab="Z-Score", font.lab=2, font=2, main="UpregulatedGenes in Patient Sample")> > Thanks in advance, > > Patrick > > The information transmitted is intended only for the p...{{dropped:19}}