From maechler at stat.math.ethz.ch  Fri Aug 19 09:58:45 2016
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Fri, 19 Aug 2016 09:58:45 +0200
Subject: [Rd] axis.POSIXct and axis.Date fail for reversed axes
In-Reply-To: <BY2PR13MB0823EB805DDF97D6EB8F7AE4CE150@BY2PR13MB0823.namprd13.prod.outlook.com>
References: <BY2PR13MB0823EB805DDF97D6EB8F7AE4CE150@BY2PR13MB0823.namprd13.prod.outlook.com>
Message-ID: <22454.48181.328072.46359@stat.math.ethz.ch>

>>>>> 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



[Rd] axis.POSIXct and axis.Date fail for reversed axes
Martin Maechler