Consider the following code:

data <- read.csv(file="summary.csv",sep=",",head=TRUE)
data = zoo(data$compressed, as.Date(data$date))
data <- aggregate(data, identity, tail, 1)
days = seq(start(data), end(data), "day")
data2 = na.locf(merge(data, zoo(,days)))

par(bty = 'n')
plot(data2,xlab='',ylab='entropy (bytes)')

How can one:

  1. Adjust both the horizontal and vertical limits of the drawn axis to match the start and end of data (as an example, while the y value may vary between 20 and 1525, the axis shows 0 and 1500).
  2. Increase the horizontal resolution (at least add some minor ticks) when the time series spans more years than are mentioned.


plot(data2,xlab='',ylab='entropy (bytes)', xaxs = 'i', yaxs = 'i')

I get:

alt text

which is not exactly what I had in mind. The vertical scale doesn't start with the exact minimum (around 25), nor does it end with the exact maximum. The horizontal scale starts and ends in the middle. Hints?

  • $\begingroup$ Don't confuse the pretty label locations for the data. The figure region has been set to the range of the data. If you want axes with labels at specific, predefined points, turn off axis drawing in the plot() call with axes = FALSE and then draw the axes using axis(side = 2) for the y axis with suitable at, and the x-axis can be drawn using axis.Date() as per my answer below. $\endgroup$ Nov 13, 2010 at 22:48

2 Answers 2


For the second Q, you can use axis.Date() with argument labels = FALSE to add minor tick marks at locations defined by argument at.


For the first question try:

plot(data2,xlab='',ylab='entropy (bytes)', xaxs = 'i', yaxs = 'i')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.