Dear all,

I'm having trouble getting the correct spacing between x-axis labels on a 
barplot. This is the command I'm using to generate the plot:

temp <- barplot(precip, beside=TRUE, xaxt="n", las=1, xpd=FALSE, col="grey28", 
ylim=c(0, max(precip)))

Here is the structure of temp:
> str(temp)
 num [1:96, 1] 0.7 1.9 3.1 4.3 5.5 6.7 7.9 9.1 10.3 11.5 ...

And here is the structure of the data being plotted:
> str(precip)
 num [1:96] 1841 2871 9254 22335 30682 ...

> length(precip)
[1] 96

These are monthly data points for 8 years (8 * 12 = 96), but I only want to 
have labels for each year (1978 to 1985), rather than every month. So I tried 
using the following command, but this results in the labels not being far 
enough apart, and therefore they don't fill the length of the x-axis (and don't 
align properly with the corresponding first bar of every year):

axis(1, at=seq(1,96,12), 1978:1985)


This one has stumped me somewhat, so I'd be grateful to receive any suggestions 
as to how I might resolve this.

Many thanks,

Steve
                                          
_________________________________________________________________

We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
______________________________________________
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.

Reply via email to