[R] setting the steps for x axis labels on plot

Gonzalo Garcia-Perate g.garcia-perate at ucl.ac.uk
Mon Mar 1 12:16:39 CET 2010

Hello, I'm new to R, I've been working with it for the last 2 weeks. I  
am plotting some data and not getting the labels on the x axis I am  
expecting on my plot.

my code reads

#hours in the day
h <- c(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
#hp is a data frame with a pivot table of 25 columns (label and data  
for 24 hours)
plot(h, as.matrix(hp[1,2:25]), main = hp[1,1], type="l", xlim=c(0,23),  
ylim=c(0,1800), xlab="hour", ylab="visitor activity")

the result you can see here: http://www.flickr.com/photos/gonzillaaa/4397357491/

I was hoping the steps on the x axis would be every hour or at least  
every two hours I am getting unevenly spaced steps (0, 5, 10, 20)  

apologies if this is too obvious a question, I've looked around on  
documentation etc. but found no reference to this.

Many thanks,


More information about the R-help mailing list