Dear List,
I have the following problem with axis.Date, here is an artificial example:
dates <- scan(what = "character")
"25/03/2000" "26/03/2000" "27/03/2000"
"28/03/2000" "29/03/2000"
"30/03/2000" "31/03/2000" "01/04/2000"
"02/04/2000" "03/04/2000"
"04/04/2000" "05/04/2000"
dates <- as.Date(as.character(dates), format = "%d/%m/%Y")
vals <- rnorm(12)
plot(x = dates, y = vals, axes = FALSE)
axis(side = 2)
box()
axis.Date(side = 1, x = dates, labels = "")
Error in axis(side, at = z, labels = labels, ...) :
formal argument "labels" matched by multiple actual arguments
Which arises because axis.Date has this in the function:
axis.Date
function (side, x, at, format, ...)
{
...
labels <- format.Date(z, format = format)
axis(side, at = z, labels = labels, ...)
invisible()
}
Commenting out the labels <- format... allows labels to be passed. I
guess there should be something checking if labels is in ... and if it
is don't generate new labels, and then don't pass this along in the ...
to axis, but I haven't got as far as working out how to use dots()
properly so I can't contribute a patch - yet, bit more reading and
experimenting to do... - or decide if this is the way things should be done.
What I want to do is is have, following my example, the days plotted
with ticks and labeled as they are, but I also want ticks for say the
hours, plotted with smaller tick marks and un-labeled.
I've worked out how to do this for my actual application (where the
years are labeled but I want months within years as unlabeled, little
ticks) but I can't suppress the labellings when using a second call to
axis.Date. Maybe this is the wrong way of doing things? If anyone has a
better idea then I'd been keen to learn.
For now I've hacked my own my.axis.Date for my purposes that works.
Thanks for your time,
Gav
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way [W] http://www.ucl.ac.uk/~ucfagls/
London. WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%