From tpapp at princeton.edu  Mon Nov 13 20:00:00 2006
From: tpapp at princeton.edu (tpapp at princeton.edu)
Date: Mon, 13 Nov 2006 20:00:00 +0100 (CET)
Subject: [Rd] wishlist: xlim in lines.polynomial (PR#9362)
Message-ID: <20061113190000.CA63E572DC@slim.kubism.ku.dk>

Full_Name: Tamas K Papp
Version: 2.4.0
OS: linux
Submission from: (NULL) (140.180.166.160)


I was using the lines.polynomial method for plotting piecewise polynomials
(parts of splines).  I needed a feature to limit the range of plotting using a
parameter given to the function (as opposed to par("usr")).  I think that the
following changes would be a nice addition:

lines.polynomial <- function (x, len = 100, xlim=par("usr")[1:2],
                              ylim=par("usr")[3:4],...)
{
    p <- x
    x <- seq(xlim[1], xlim[2], len = len)
    y <- predict(p, x)
    y[y <= ylim[1] | y >= ylim[2]] <- NA
    lines(x, y, ...)
}

Package:       polynom
Version:       1.2-3
Date:          2006-09-09



[Rd] wishlist: xlim in lines.polynomial (PR#9362)
tpapp at princeton.edu