[R] Programming Question (setting ylim generally)

stephen sefick ssefick at gmail.com
Fri Jan 9 06:22:39 CET 2009


library(StreamMetabolism)

day <- (structure(c(10.08, 10.08, 10.05, 10.03, 10, 9.98, 9.96, 9.95,
9.95, 9.96, 9.96, 9.98, 10.01, 10.05, 10.06, 10.09, 10.11, 10.11,
10.13, 10.13, 10.15, 10.15, 10.13, 10.14, 10.11, 10.13, 10.14,
10.13, 10.12, 10.13, 10.14, 10.16, 10.18, 10.19, 10.23, 10.27,
10.33, 10.37, 10.45, 10.57, 10.6, 10.66, 10.73, 10.77, 10.84,
10.86, 10.87, 10.94, 10.98, 11.01, 11.05, 11.09, 11.11, 11.12,
11.14, 11.13, 11.15, 11.14, 11.13, 11.13, 11.12, 11.09, 11.08,
11.07, 11.05, 11.04, 11.03, 11.01, 10.99, 11, 10.94, 10.91, 10.86,
10.82, 10.77, 10.73, 10.7, 10.63, 10.59, 10.54, 10.47, 10.37,
10.3, 10.23, 10.18, 10.13, 10.09, 10.05, 10.02, 9.98, 9.96, 9.95,
9.94, 9.93, 9.94, 9.97), index = structure(c(13600.0006944444,
13600.0111111111, 13600.0215277778, 13600.0319444444, 13600.0423611111,
13600.0527777778, 13600.0631944444, 13600.0736111111, 13600.0840277778,
13600.0944444444, 13600.1048611111, 13600.1152777778, 13600.1256944444,
13600.1361111111, 13600.1465277778, 13600.1569444444, 13600.1673611111,
13600.1777777778, 13600.1881944444, 13600.1986111111, 13600.2090277778,
13600.2194444444, 13600.2298611111, 13600.2402777778, 13600.2506944444,
13600.2611111111, 13600.2715277778, 13600.2819444444, 13600.2923611111,
13600.3027777778, 13600.3131944444, 13600.3236111111, 13600.3340277778,
13600.3444444444, 13600.3548611111, 13600.3652777778, 13600.3756944444,
13600.3861111111, 13600.3965277778, 13600.4069444444, 13600.4173611111,
13600.4277777778, 13600.4381944444, 13600.4486111111, 13600.4590277778,
13600.4694444444, 13600.4798611111, 13600.4902777778, 13600.5006944444,
13600.5111111111, 13600.5215277778, 13600.5319444444, 13600.5423611111,
13600.5527777778, 13600.5631944444, 13600.5736111111, 13600.5840277778,
13600.5944444444, 13600.6048611111, 13600.6152777778, 13600.6256944444,
13600.6361111111, 13600.6465277778, 13600.6569444444, 13600.6673611111,
13600.6777777778, 13600.6881944444, 13600.6986111111, 13600.7090277778,
13600.7194444444, 13600.7298611111, 13600.7402777778, 13600.7506944444,
13600.7611111111, 13600.7715277778, 13600.7819444444, 13600.7923611111,
13600.8027777778, 13600.8131944444, 13600.8236111111, 13600.8340277778,
13600.8444444444, 13600.8548611111, 13600.8652777778, 13600.8756944444,
13600.8861111111, 13600.8965277778, 13600.9069444444, 13600.9173611111,
13600.9277777778, 13600.9381944444, 13600.9486111111, 13600.9590277778,
13600.9694444444, 13600.9798611111, 13600.9902777778), format =
structure(c("m/d/y",
"h:m:s"), .Names = c("dates", "times")), origin = structure(c(1,
1, 1970), .Names = c("month", "day", "year")), class = c("chron",
"dates", "times")), class = "zoo"))

plot.e <- function(b, w, x, y, z){
a <- window.chron(b, w, x, y, z)
low <- min(b*0.98)+5
high <- max(b*1.02)+5
plot(a, ylim=c(low, high))
lines(a*0.98, col="blue")
lines(a*1.02, col="red")
}

plot.e(day, "03/28/2007", "00:00:00", "03/28/2007", "23:46:00")

why do the low and high objects not set the ylim of the plotting function?

thanks

-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis




More information about the R-help mailing list