From lachmann at eva.mpg.de  Thu Apr 26 12:21:24 2012
From: lachmann at eva.mpg.de (ghostwheel)
Date: Thu, 26 Apr 2012 03:21:24 -0700 (PDT)
Subject: [Rd] I wish xlim=c(0,
	NA) would work. How about I send you a patch?
In-Reply-To: <1335432661373-4589316.post@n4.nabble.com>
References: <CAErODj9RJ60Xdp=sLu=pGRiBOY_CSsxnjUmqObxhHYtEhHyLxA@mail.gmail.com>
	<CAFEqCdzg13nc_HvuKCA0xiS1F=YqKKvz4VKXn8_4cfqUmGABNg@mail.gmail.com>
	<1335187455478-4580388.post@n4.nabble.com>
	<1335432661373-4589316.post@n4.nabble.com>
Message-ID: <1335435684455-4589400.post@n4.nabble.com>

Sorry, the previous had a bug and was quite ugly. This is a bit better:
--
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 ) {
          xlim.in=xlim
          xlim = range(xy$x[is.finite(xy$x)])
          xlim[pmatch( names(xlim.in),c("min","max") )] = xlim.in
          xlim
        } else xlim
        ylim <- if (is.null(ylim))
                      range(xy$y[is.finite(xy$y)])
            else  if( length(ylim)==1 ) {
          ylim.in=ylim
          ylim = range(xy$y[is.finite(xy$y)])
          ylim[pmatch( names(ylim.in),c("min","max") )] = ylim.in
          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-tp4562269p4589400.html
Sent from the R devel mailing list archive at Nabble.com.



[Rd] I wish xlim=c(0, NA) would work. How about I send you a patch?
ghostwheel