[R] Ylim

Steve Lianoglou mailinglist.honeypot at gmail.com
Thu Aug 6 22:58:28 CEST 2009


Hi,

On Aug 6, 2009, at 4:48 PM, Mohsen Jafarikia wrote:

> Hello All:
> Can anybody tell me what is the problem with my program please. I  
> have an
> error message as appears below.
>
> My program is:
>
> ifn <- "Jul08_09.LM"
> data <- read.table(ifn)
>
> ofn <- "Jul.png"
>
> bitmap(ofn, type = "png256", width = 30, height = 30, pointsize =  
> 30, bg =
> "white",res=50)
> par(mar=c(5, 5, 3, 2),lwd=5)
> par(cex.main=1.6,cex.lab=1.6,cex.axis=1.6)
>
> par(mfrow = c(3,4))
>
> ifn   <- "T.dat"
> trait <- read.table(ifn)
>
> i <- 1
> j <- 1
>
> for(k in 1:12)
> {
> dat  <- data[i:(i+2), ]
>
> colnames(dat)<-c("SM","E","NP)
>
> Ymin <- if( min(dat$SM) < 0.0 ) (dat$SM - dat$E) else 0.0
> Ymax <- if( max(dat$SM) > 0.0 ) (dat$SM + dat$E) else 0.0
>
> Graph<-barplot(dat$SM, names.arg=dat$NP, main = trait[j:j,], xlab =
> data[i:i,1:1], ylim = c(Ymin,Ymax) )
>
> segments(Graph, dat$SM + dat$E, Graph, dat$SM - dat$E)
> i <- i + 3
> j <- j + 1
> }
>
> dev.off()
>
> And the error message is:
>
> Error in plot.window(xlim, ylim, log = log, ...) : invalid 'ylim'  
> value
> Calls: barplot -> barplot.default -> plot.window
> Execution halted

Did you take a look at what c(Ymin, Ymax) is?

-steve

--
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




More information about the R-help mailing list