Skip to content

Plots using POSIX

4 messages · Shawn Way, Duncan Murdoch, Brian Ripley

#
Is there a reason that the bottom axis changes color when POSIX data is used
in plot function?

For example:
As compared to:
I assume that the work around is to place the box and axis after the plot is
created, correct?

Shawn Way
Engineering Manager
Tanox, Inc.
#
On Thu, 26 Jun 2003, Shawn Way wrote:

            
It's not the same plot function, that's why.
Or the lines after the plot is created.

  
    
#
On Thu, 26 Jun 2003 07:59:00 -0500, Shawn Way <sway at tanox.com> wrote :
It's the old problem of too much of ... being passed onwards.  Here's
the current definition:

plot.POSIXct <- function (x, y, xlab = "", xaxt = par("xaxt"), ...) 
{
    axisInt <- function(x, main, sub, xlab, ylab, ...) axis.POSIXct(1,
        x, ...)
    plot.default(x, y, xaxt = "n", xlab = xlab, ...)
    if (xaxt != "n") 
        axisInt(x, ...)
}

The "col" argument is being passed to axisInt, but it should have been
intercepted.  Here's one way to intercept it:

plot.POSIXct <- function (x, y, xlab = "", xaxt = par("xaxt"), col =
par("col"), ...) 
{
    axisInt <- function(x, main, sub, xlab, ylab, ...) axis.POSIXct(1,
        x, ...)
    plot.default(x, y, xaxt = "n", xlab = xlab, col = col, ...)
    if (xaxt != "n") 
        axisInt(x, ...)
}

However, this would still mess up if "lty" or "lwd" were specified;
are there others?
That's another way.

Duncan Murdoch
#
On Thu, 26 Jun 2003, Duncan Murdoch wrote:

            
Just add those that should not be passed on to the defn of axisInt,
rather than clutter the argument list.