[Rd] axTicks on a reverse ylog plot (PR#7973)

ligges@statistik.uni-dortmund.de ligges at statistik.uni-dortmund.de
Fri Jul 8 13:47:18 CEST 2005


Here we go:

the quick fix is really easy, just sorting stuff in axTicks() 
(.../src/library/graphics/R/axis.R, diff'ed against R-release) is 
sufficient:


--- axis.R
+++ axis-fix.R
@@ -29,7 +29,8 @@
              stop("invalid positive 'axp[3]'")
          if(is.null(usr)) usr <- par("usr")[if(is.x) 1:2 else 3:4]
          else if(!is.numeric(usr) || length(usr) != 2) stop("invalid 
'usr'")
-        ii <- round(log10(axp[1:2]))
+        ii <- round(log10(sort(axp[1:2])))
+        usr <- sort(usr)
          x10 <- 10^((ii[1] - (iC >= 2)):ii[2])
      r <- switch(iC,             ## axp[3]
              x10,            ## 1



BTW: In your R code below, you have to use (as documented)
   grid(equilogs = FALSE)


We might want to consider to change axTicks anyway:
We could return values from the internal axis() calculations
and therefore replace axTicks calculations by stuff that is much more 
reliable. Opinions?

The current equilogs default argument setting is inconvinient anyway,
because it does not fit with the current device setting for real axis 
ticks  (which can also be done in R, of course).

Uwe Ligges





mwtoews at sfu.ca wrote:

> There is still issues with the reversed y-log scale plot:
> 
> # Test case A: works as expected
> plot(10:100,log="y",ylim=c(100,11))
> grid()
> par("yaxp")
> 
> # Test case B: grid does not have horizontal lines; par("yaxp") is  
> different
> plot(1:100,log="y",ylim=c(100,10))
> grid()
> par("yaxp")
> 
> In the second test case, axTicks for the horizontal lines (in grid())  
> returns numeric(0) for spacing ... how do the tick marks get drawn in  
> the first place??
> -mt
> 
> --please do not edit the information below--
> 
> Version:
> platform = powerpc-apple-darwin8.1.0
> arch = powerpc
> os = darwin8.1.0
> system = powerpc, darwin8.1.0
> status = Patched
> major = 2
> minor = 1.1
> year = 2005
> month = 06
> day = 26
> language = R
> 
> Locale:
> en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
> 
> Search Path:
> .GlobalEnv, package:methods, package:stats, package:graphics,  
> package:grDevices, package:utils, package:datasets, Autoloads,  
> package:base
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list