[R] Barplot axis titles

RagingJim nowa0021 at flinders.edu.au
Thu Feb 11 03:03:31 CET 2010


Now, I think I am making this harder than it seems, but...

I am writing a script that will allow me to pull any csv file with annual
rainfall and plot it into a bar plot. The problem I am facing is that the
different sites have recorded data for a different number of years. This
means that every csv file has a different number of values.

I need to somehow get a label at every 10 or 20 year points, and it has be
able to allow for the fact that some files have 50 readings, and others have
200 readings.

Now, if I use this:

#axis(1,at=seq(1,rows,10),tcl=-0.5,labels=c(kent[1,2],kent[11,2],kent[21,2],kent[31,2],kent[41,2],kent[51,2],kent[61,2],kent[71,2],kent[81,2],kent[91,2]...

I can get it for one file, but as soon as a file has a diff number of
values, it does not work.

The best I have been able to come up with is this:

barplot(Ann,main=title, xlab="Year",ylab="Rainfall
(mm)",ylim=c(0,ymax),col="blue",space=0,names.arg=c(kent[,2]),cex.names=0.8)

however I cannot control how often the labels occur. I am sure there is an
easy way to do this, but I cannot find it. I assume it will have something
to do with names.arg, but I am not sure how to write what i want to write.

Cheers, in advance.
-- 
View this message in context: http://n4.nabble.com/Barplot-axis-titles-tp1476789p1476789.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list