Hi Dataframe fdf contains bin rate overlay 1 1 90 Assign First/cc _from_SN_53 RNC_20_to_SN_50 RNC_21_Success Rate 2 2 93 Assign First/cc _from_SN_53 RNC_20_to_SN_50 RNC_21_Success Rate 3 1 90 Assign First/cc _from_SN_50 RNC_21_to_SN_53 RNC_20_Success Rate 4 2 94 Assign First/cc _from_SN_50 RNC_21_to_SN_53 RNC_20_Success Rate time 1 (04/01/08 16:02:30) 2 (04/01/08 16:07:30) 3 (04/01/08 16:02:30) 4 (04/01/08 16:07:30) And then I write the following lines of code to plot a xygraph on a pdf file n <- length(unique(fdf$time)) x <-sort(unique(fdf$time)) y<-UTCsecs2chron(x) xscales <- computeTimeScales(y) yscales<-NULL scales<-c(xscales,yscales) ylab<-"session transfer rate" xlab<-"time" lgnd.txt<-levels(fdf$overlay) celnet.trellis.device(device="pdf", file="ravi_st.pdf", width=10,height = 10) main<-"this is the first report" formd="rate ~ as.numeric(time)" print( xyplot(formula(formd), data = fdf, groups = overlay, type = "b", as.table = TRUE, cex=0.20, #subset = ok, commented to show breaks in graph main = main, xlab = "Time", ylab = ylab, scales = scales, key = simpleKey(text = lgnd.txt, cex = 3/4, points = FALSE, lines = TRUE), page = function(n) annotate(opts$ann), sub = "", layout = c(1,1) ) ) "computeTimeScales" <- function(z, rot=0) ## z is a chron object {browser() ## how many days do the data span? n.days <- ceiling(diff(range(z, na.rm = TRUE))) ## compute x ticks, pretty labels x <- as.numeric(z) r <- range(x, na.rm = TRUE) at.x <- seq(from = r[1], to = r[2], length = 7) two_digits <- function(x){ x <- paste("0", x, sep="") substring(x,nchar(x)-1) } ## heuristics: use hh:mm when range of data falls within one day, ## otherwise use MM-DD hh:mm. at.z <- chron(at.x) hh <- paste(two_digits(hours(at.z)), two_digits(minutes(at.z)), sep=":") if(0){ ## hh:ss # this is commented as for more than one day from/to time no date was printed at.lbls <- hh } else { ## MM-DD\nhh:ss m <- month.day.year(at.z) dd <- paste(two_digits(m$month), two_digits(m$day), sep="-") at.lbls <- paste(dd, hh, sep="\n") } list(x=list(at = at.x, rot=rot, labels = at.lbls)) } "celnet.theme" <- function() { celnet.theme <- canonical.theme("pdf", color = TRUE) if(tolower(.Device) =="png") celnet.theme$background$col <- "white" else canonical.theme("pdf", color = TRUE) celnet.theme$background$col <- "transparent" celnet.theme } "celnet.trellis.device" <- function(device, file, width = NULL, height = NULL,...) { ## analogous to trellis.device() -- this is just tailored to Celnet if(is.null(width)) width <- 8 if(is.null(height)) height <- 6 if(tolower(device)=="png"){ if(missing(width)) width <- 72 * width if(missing(height)) height <- 72 * height } if(tolower(device)=="x11") trellis.device(device, width=width, height=height, theme=celnet.theme()) if(tolower(device)=="ps" || tolower(device)=="postscript") trellis.device("postscript", file=file, color = TRUE, width=width, height=height, theme=celnet.theme()) else trellis.device(device, file=file, width=width, height=height, theme=celnet.theme()) } "annotate" <- function(str, ...) ## print a metadata message at the top-bottom of current trellis display { else if(n==1){ x <- 0.95 hjust <- "right" } else if(n==2){ x <- c(0.05, 0.95) hjust <- c("left", "right") } else if(n==3){ x <- c(0.05, 0.50, 0.95) hjust <- c("left", "center", "right") } x <- unit(x, "npc") y <- unit(1.5, "lines") ## at 0.5, 1.5, ... lines for(i in seq(along = x)){ grid.text(label = str[i], x = x[i], y = y, just = c(hjust[i], "bottom"), ...) } invisible(str) } n <- length(str) ## one line per string if(n==0) return(invisible(str)) } But I did nt get any desired o/p on a file ravi_st.pdf Desired o/p is Rate ~ as.numeric(time) Group=overlay Can any one tell how can I get the desired o/p [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.
[R] need some help in plotting xy graph
Kurapati, Ravichandra (Ravichandra) Tue, 20 May 2008 23:52:10 -0700
- [R] need some help in plotting xy grap... Kurapati, Ravichandra (Ravichandra)
- [R] need some help in plotting xy... Kurapati, Ravichandra (Ravichandra)
- [R] need some help in plotting xy... Kurapati, Ravichandra (Ravichandra)