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

From: ghostwheel <lachmann_at_eva.mpg.de>
Date: Thu, 26 Apr 2012 03:21:24 -0700 (PDT)

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.



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 26 Apr 2012 - 10:25:08 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 26 Apr 2012 - 10:31:03 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive