[R] no x label using axis.Date

MacQueen, Don macqueen1 at llnl.gov
Fri Jun 13 19:03:35 CEST 2014

I'd suggest a different strategy for calculating your axis. You may also
be using the axis.Date() function incorrectly. See this example:

tmpd <- data.frame(dt=seq.Date( as.Date('2014-1-7'),
as.Date('2014-08-13'), len=15),
xax <- seq.Date(min(tmpd$dt), max(tmpd$dt), by='mon')

plot(tmpd$dt, tmpd$y, xaxt='n')axis(1, at=xax, lab=format(xax,'%b-%Y'))

By the way, most of the information in your post does not appear to be
relevant to your question (all the stuff starting with and following the
first par() statement), and it is distracting. It's always best to pare
things down to the minimum, as it makes it easier for potential helpers.
Also, it's hard to figure out why your attempt doesn't work, because you
haven't provided a reproducible example, which is easily done.


Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550

On 6/12/14 7:47 PM, "MKN" <matthewnewland at gauge.com.au> wrote:

>I have tried multiple different methods to figure out how to get a date
>of my preference (start date of each month). Any assistance would be
>The below section is not producing a date axis:
>The above section is used in the following plot:
>       legend=ALegend)
>title(main=Amain, ylab=Labely,
>      outer=TRUE,cex.lab=1, cex.main=1.5)
>Below is an excerpt of the total days data:
>	totaldays	        y
>1	2013-11-01	1
>2	2013-11-02	1
>3	2013-11-03	1
>4	2013-11-04	1
>5	2013-11-05	1
>6	2013-11-06	1
>7	2013-11-07	1
>8	2013-11-08	1
>9	2013-11-09	1
>10	2013-11-10	1
>View this message in context:
>Sent from the R help mailing list archive at Nabble.com.
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list