I would like to place the x-axis labels between the ticks.
For example, by default R produces a graph that looks like this:
(Note, I added axis(1,c(2001,2002,2003
You can offset the labels and the ticks with separate calls to axis
.
(The example below does not look much like your data, but the idea is the same.)
Plot whatever, but keep the axes off.
plot(1:10, axes = FALSE)
Plot the labels at a half spacing offset and turn off the ticks. (Reverse the numbers just to be "interesting").
axis(1, at = (1:10) + 0.5, labels = 10:1, tick = FALSE)
Add the ticks back at the normal position, and keep the labels off. Add a box to finish the job.
Be careful though, the labels are now kind of ambiguous in terms of which tick they refer to, and what the tick position actually is (though for a year start to end that should not be a problem).
axis(1, at = (1:10), labels = FALSE, tick = TRUE)
box()
You can use axis(2, ...)
to construct the y-axis in the same way, or just use defaults with axis(2)
.