You may want to try something like this: x1<-rnorm(500) plot(x1) test<-seq(1987, 2002, by=1) test_2<-seq(2003, 2006, by=1) test<-format(c(test, test_2), width=5) xxx<-seq(1,500,length=length(test)) axis(1,at=xxx,labels=test,line=1,col=0)
You'll need to specify where you want the labels (in this code I do that with xxx). -tgs On Tue, Oct 19, 2010 at 12:55 PM, Simon Kiss <sjk...@gmail.com> wrote: > Dear colleagues, this seems like an easy problem, and I found some > suggestions which I've incorporated in the help list, but I can't quite get > it right. > I want to add a series of years to a second x-axis category label. I > generate them with test and test_2 below, format them with some spacing > (which is the suggestion I took from the R-list) and concatenate them and > then write them with mtext. At the end, the labels in test are bunched up > together in the center of the plot window. Can anyone suggest a way to > space out the elements of "test" to look like evenly-spaced x-labels? > Yours, > Simon Kiss > > x1<-rnorm(500) > plot(x1) > > test<-seq(1987, 2002, by=1) > > test_2<-seq(2003, 2006, by=1) > > test<-format(c(test, test_2), width=5) > > mtext(test, side=1, line=2) > ********************************* > Simon J. Kiss, PhD > Assistant Professor, Wilfrid Laurier University > 73 George Street > Brantford, Ontario, Canada > N3T 2C9 > Cell: +1 519 761 7606 > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.