[R] trouble with plotrix package

Ben Bolker bolker at ufl.edu
Fri May 19 22:06:23 CEST 2006


Randy Zelick <zelickr <at> pdx.edu> writes:

> 
> There is a switch to set the upper bound on rings (radial.lim) but I don't 
> see a way to specify the lower bound. What I want is a "bullseye" plot 
> that goes from my start value (first ring at 10) to my end value (last 
> ring at 100) independent of the data range.
> 
> Thanks!!
> 
> =Randy=
> 

  I would suggest dumping radial.plot to a file and making
the following hacks:

  - change the default value of radial.lim from NA to range(lengths)
  - delete the second and third lines of code that set radial.lim to
max(lengths) if it is NA
  - change grid.pos to be set to pretty(radial.lim)

  this behavior seems more sensible to me -- if one wanted to
make it backward compatible one could hack it with something like

if (!missing(radial.lim) && length(radial.lim)==1) radial.lim <-
c(min(lengths),radial.lim)

 perhaps Jim Lemon will want to incorporate these changes

  the following verbose diff file says the same thing.

***************
*** 2,12 ****
      label.prop = 1.1, main = "", xlab = "", ylab = "", line.col = par("fg"),
      mar = c(2, 2, 3, 2), show.grid = TRUE, grid.col = "gray",
      grid.bg = par("bg"), point.symbols = NULL, point.col = NULL,
!     show.centroid = FALSE, radial.lim = NA, ...)
  {
      length.dim <- dim(lengths)
-     if (is.na(radial.lim))
-         radial.lim <- max(lengths)
      if (is.null(length.dim)) {
          npoints <- length(lengths)
          nsets <- 1
--- 2,10 ----
      label.prop = 1.1, main = "", xlab = "", ylab = "", line.col = par("fg"),
      mar = c(2, 2, 3, 2), show.grid = TRUE, grid.col = "gray",
      grid.bg = par("bg"), point.symbols = NULL, point.col = NULL,
!     show.centroid = FALSE, radial.lim = range(lengths), ...)
  {
      length.dim <- dim(lengths)
      if (is.null(length.dim)) {
          npoints <- length(lengths)
          nsets <- 1
***************
*** 23,29 ****
          radial.pos <- matrix(rep(radial.pos, nsets), nrow = nsets,
              byrow = TRUE)
      if (show.grid) {
!         grid.pos <- pretty(c(lengths, radial.lim))
          if (grid.pos[1] <= 0)
              grid.pos <- grid.pos[-1]
          maxlength <- max(grid.pos)
--- 21,27 ----
          radial.pos <- matrix(rep(radial.pos, nsets), nrow = nsets,
              byrow = TRUE)
      if (show.grid) {
!       grid.pos <- pretty(radial.lim)
          if (grid.pos[1] <= 0)
              grid.pos <- grid.pos[-1]
          maxlength <- max(grid.pos)
***************
*** 96,98 ****



More information about the R-help mailing list