[Rd] rug(x) clip warning incorrect if par("xlog")==TRUE (PR#1188)

cberry@tajo.ucsd.edu cberry@tajo.ucsd.edu
Thu, 29 Nov 2001 22:13:41 +0100 (MET)


To wit:

> plot(1:2,1:2,log="x")
> rug(1:2)      # should not warn
Warning message: 
some values will be clipped in: rug(1:2) 
> plot(1:2,1:2,log="x")
> rug(c(0,.1,.2))  # should warn, but does not
> 

I believe this fixes the problem:

% diff -c /tmp/orig.rug.R /tmp/cberry.rug.R 
*** /tmp/orig.rug.R	Thu Nov 29 12:59:00 2001
--- /tmp/cberry.rug.R	Thu Nov 29 12:57:50 2001
***************
*** 11,19 ****
      on.exit(par(oldcol), add = TRUE)
    }
    usr <- par("usr")
!   usr <- if (side%%2 == 1) 
!     usr[1:2]
!   else usr[3:4]
    if (any(x < usr[1] | x > usr[2])) 
      warning("some values will be clipped")
    axis(side, at = x, lab = FALSE, lwd = lwd)
--- 11,25 ----
      on.exit(par(oldcol), add = TRUE)
    }
    usr <- par("usr")
!   usr <- if (side%%2 == 1) {
!     if (par("xlog"))
!       10^(usr[1:2])
!     else usr[1:2]
!   }
!   else {
!     if (par("ylog"))
!       10^(usr[3:4])
!     else usr[3:4]}  
    if (any(x < usr[1] | x > usr[2])) 
      warning("some values will be clipped")
    axis(side, at = x, lab = FALSE, lwd = lwd)


Chuck

--please do not edit the information below--

Version:
 platform = i686-pc-linux-gnu
 arch = i686
 os = linux-gnu
 system = i686, linux-gnu
 status = 
 major = 1
 minor = 3.0
 year = 2001
 month = 06
 day = 22
 language = R

Search Path:
 .GlobalEnv, package:splines, package:survival, package:ctest, Autoloads,
package:base
> 


Charles C. Berry                        (858) 534-2098 
                                         Dept of Family/Preventive Medicine
E mailto:cberry@tajo.ucsd.edu	         UC San Diego
http://hacuna.ucsd.edu/members/ccb.html  La Jolla, San Diego 92093-0645

 


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._