[Rd] axis.POSIXct and axis.Date fail for reversed axes
Martin Maechler
maechler at stat.math.ethz.ch
Fri Aug 19 09:58:45 CEST 2016
>>>>> William May <williamcmay at live.com>
>>>>> on Thu, 18 Aug 2016 22:06:36 +0000 writes:
> When plotting a reversed time axis with the base graphics system, R
> fails to label the axes.
> Example:
> times <- c(Sys.time() - 100, Sys.time())
> plot(times, 1:2, xlim = times) # correctly labels the x-axis
> plot(times, 1:2, xlim = rev(times)) # fails to label the x-axis
> axis.POSIXct(1, times) # still fails to add labels
> dates <- c(Sys.Date() - 10, Sys.Date())
> plot(dates, 1:2, xlim = dates) # correctly labels the x-axis
> plot(dates, 1:2, xlim = rev(dates)) # fails to label the x-axis
> axis.Date(1, dates) # still fails to add labels
> This is clearly due to the variable keep in both axis functions.
> keep <- z >= range[1L] & z <= range[2L]
> But if the axis is reversed that should be:
> keep <- z <= range[1L] & z >= range[2L]
yes, something like that, you are right.
Thank you very much, William, for the succinct report and diagnosis!
I'm going to fix this.
Martin
More information about the R-devel
mailing list