[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 12:21:24 CEST 2012


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.



More information about the R-devel mailing list