From Martin Maechler <maechler@stat.math.ethz.ch>  Wed May 21 12:00:00 1997
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Wed, 21 May 97 13:00:00 +0200
Subject: R-alpha: plot(1); axis(1, at=10) >>> Seg.fault  -- and a patch
Message-ID: <9705211100.AA00805@>


This problem has been mentioned  by Arne Kovac <maak@stats.bris.ac.uk>  on May 9-10.
The patch is really a replacement of 'axis' in  RHOME/src/library/base/funs/

It contains the fixes which where proposed Arne Kovac
and fixes (all?) the errors he/she (?) reported on May 9.

"axis" <-
function (which, at, labels = TRUE, ...) 
{
	if (which%%2 == 1) {
		axp <- par("xaxp")
		usr <- par("usr")[1:2]
		log <- par("xlog")
	}
	else {
		axp <- par("yaxp")
		usr <- par("usr")[3:4]
		log <- par("ylog")
	}
	if (missing(at)) {
		if (log) {
			if (usr[2] < usr[1] + 1) {
				at <- seq(axp[1], axp[2], length = axp[3] + 1)
			}
			else {
				p1 <- ceiling(min(usr))
				p2 <- floor(max(usr))
				if (p2 - p1 < 2) {
				 at <- c(1, 2, 5) * 10^rep(p1:p2, rep(3, p2 - p1 + 1))
				 at <- at[10^usr[1] <= at & at < 10^usr[2]]
				}
				else at <- 10^seq(p1, p2, by = 1)
			}
		}
		else at <- seq(axp[1], axp[2], length = axp[3] + 1)
		ind <- rep(TRUE, length(at))
	}
	else {
		ind <- (usr[1] <= at & at <= usr[2])
	}
	if (is.logical(labels)) {
		if (labels) {
			if (!log) 
				at[abs(at/(max(at) - min(at))) < 0.001] <- 0
			labels <- format(at, trim = T)
		}
		else labels <- rep("", length(at))
	}
	else labels <- format(labels, trim = T)
	.Internal(axis(which, as.double(at[ind]), labels[ind], ...))
}

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: plot(1); axis(1, at=10) >>> Seg.fault -- and a patch
Martin Maechler