From ripley at stats.ox.ac.uk  Wed Apr 17 10:15:57 2013
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 17 Apr 2013 09:15:57 +0100
Subject: [Rd] support for POSIXct classes in image.default axes
In-Reply-To: <CAAcGz9-aTEH-hfwbE53r1tchdxCYdNHT7qmcvrJLPSoyrv99aQ@mail.gmail.com>
References: <CAAcGz9-aTEH-hfwbE53r1tchdxCYdNHT7qmcvrJLPSoyrv99aQ@mail.gmail.com>
Message-ID: <516E5A3D.7060201@stats.ox.ac.uk>

On 12/04/2013 12:27, Michael Sumner wrote:
> Hello, I would like to suggest the following change to image.default in
> src\library\graphics\R\image.R:
>
> 98c98
> <       plot(NA, NA, xlim = xlim, ylim = ylim, type = "n", xaxs = xaxs,
> ---
>>        plot(x[1], y[1], xlim = xlim, ylim = ylim, type = "n", xaxs = xaxs,
>

I think xlim, ylim is a better idea: this relies on range() preserving 
the class.

Done now (in R-devel pro tem).

> This provides all the support of axis.POSIXt that plot.default gives,
> currently the default new plot in image.default uses NAs and the axis class
> is ignored. This is nice for plotting time series data stored in a matrix.
>
> Here's a dummy example that shows usage with my change:
>
> data(volcano)
> x <- list(x = Sys.time() + seq(1, 1e6, length = nrow(volcano)), y =
> 1:ncol(volcano), z = volcano)
>
> ## date-time formatting on the x-axis
> image(x)
>
> ## date-time formatting on the y-axis
> image(x$y, x$x, t(x$z))
>
> Without the change we get the very large underlying numeric values for the
> times on the axis.
>
> We can still override the default axis to do a workaround: :
> image(x, axes = FALSE)
> axis.POSIXct(x$x, side = 1)
>
> Cheers, Mike.
>
>
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] support for POSIXct classes in image.default axes
Prof Brian Ripley