[Rd] I wish xlim=c(0, NA) would work. How about I send you a patch?
ghostwheel
lachmann at eva.mpg.de
Thu Apr 26 11:31:01 CEST 2012
The following seems to work well, and I don't think it'll break anything.
The only problem I see is if someone says xlim=c(min=9, max=0), which should
give an error/warning message, but won't.
Michael
---
plot.default=
function (x, y = NULL, type = "p", xlim = NULL, ylim = NULL,
log = "", main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
ann = par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL,
panel.last = NULL, asp = NA, ...)
{
localAxis <- function(..., col, bg, pch, cex, lty, lwd) Axis(...)
localBox <- function(..., col, bg, pch, cex, lty, lwd) box(...)
localWindow <- function(..., col, bg, pch, cex, lty, lwd)
plot.window(...)
localTitle <- function(..., col, bg, pch, cex, lty, lwd)
title(...)
xlabel <- if (!missing(x))
deparse(substitute(x))
ylabel <- if (!missing(y))
deparse(substitute(y))
xy <- xy.coords(x, y, xlabel, ylabel, log)
xlab <- if (is.null(xlab))
xy$xlab
else xlab
ylab <- if (is.null(ylab))
xy$ylab
else ylab
xlim <- if (is.null(xlim))
range(xy$x[is.finite(xy$x)])
else if( length(xlim)==1 & names(xlim)=="min" ) {
c(xlim,range(xy$x[is.finite(xy$x)])[2]) }
else if( length(xlim)==1 & names(xlim)=="max" ) {
c( range(xy$x[is.finite(xy$x)])[1], xlim) }
else xlim
ylim <- if (is.null(ylim))
range(xy$y[is.finite(xy$y)])
else if( length(ylim)==1 & names(ylim)=="min" ) {
c( ylim,range(xy$y[is.finite(xy$y)])[2]) }
else if( length(ylim)==1 & names(ylim)=="max" ) {
c( range(xy$y[is.finite(xy$y)])[1], ylim) }
else ylim
dev.hold()
on.exit(dev.flush())
plot.new()
localWindow(xlim, ylim, log, asp, ...)
panel.first
plot.xy(xy, type, ...)
panel.last
if (axes) {
localAxis(if (is.null(y))
xy$x
else x, side = 1, ...)
localAxis(if (is.null(y))
x
else y, side = 2, ...)
}
if (frame.plot)
localBox(...)
if (ann)
localTitle(main = main, sub = sub, xlab = xlab, ylab =
ylab,
...)
invisible()
}
--
View this message in context: http://r.789695.n4.nabble.com/I-wish-xlim-c-0-NA-would-work-How-about-I-send-you-a-patch-tp4562269p4589316.html
Sent from the R devel mailing list archive at Nabble.com.
More information about the R-devel
mailing list