[R] Question about dotplot

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun Nov 29 23:51:33 CET 1998


Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:

> Norm Josephy <NJOSEPHY at bentley.edu> writes:
> 
> > This groups components a,b,c,d,e,p, then a break, then 
> > components q,r,s,t, then a break, then f to o, then a break, 
> > then u to z. The G1 label is aligned at the same level as 
> > the d entry, and the G2 label is aligned with the m entry.
> > 
> > Does this make sense?
> 
> Happens on Unix too, and no: it doesn't make sense...
> 
....
> groups is getting ordered *twice* there. Dropping the [o] in the
> diff() makes the extra gaps go away, but now the group labels look
> wrong. Oh, well.

OK, fixed for 0.63.1. Here's the patch (cut'n'pasted in from another
window, watch out for whitespace changes!):

RCS file: /users/rdev/R/CVS-ARCHIVE/R/src/library/base/R/dotplot.R,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -c -r1.6 -r1.6.2.1
*** /tmp/T0a001XK       Mon Nov 30 11:41:24 1998
--- /tmp/T1a001XK       Mon Nov 30 11:41:24 1998
***************
*** 54,60 ****
        o <- rev(order(as.numeric(groups)))
        x <- x[o]
        groups <- groups[o]
!       offset <- cumsum(c(0, diff(as.numeric(groups)[o]) != 0))
        y <- 1:n + 2 * offset
        ylim <- range(0, y + 2)
      }
--- 54,60 ----
        o <- rev(order(as.numeric(groups)))
        x <- x[o]
        groups <- groups[o]
!       offset <- cumsum(c(0, diff(as.numeric(groups)) != 0))
        y <- 1:n + 2 * offset
        ylim <- range(0, y + 2)
      }
***************
*** 73,79 ****
      abline(h = y, lty = "dotted", col = lcolor)
      points(x, y, pch = pch, col = color, bg = bg)
      if (!is.null(groups)) {
!       gpos <- rev(cumsum(tapply(groups, groups, length) + 2) - 1)
        ginch <- max(strwidth(glabels, "inch"), na.rm = TRUE)
        goffset <- (max(linch+0.2, ginch, na.rm = TRUE) + 0.1)/lheight
        for(i in 1:nlevels(groups))
--- 73,79 ----
      abline(h = y, lty = "dotted", col = lcolor)
      points(x, y, pch = pch, col = color, bg = bg)
      if (!is.null(groups)) {
!       gpos <- rev(cumsum(rev(tapply(groups, groups, length)) + 2) - 1)
        ginch <- max(strwidth(glabels, "inch"), na.rm = TRUE)
        goffset <- (max(linch+0.2, ginch, na.rm = TRUE) + 0.1)/lheight
        for(i in 1:nlevels(groups))


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list