[R] barplot and x-axis font size
Jim Lemon
jim at bitwrit.com.au
Wed Aug 4 14:34:46 CEST 2010
On 08/04/2010 05:38 PM, Roslina Zakaria wrote:
> Hi all,
>
> I would like to draw a side by side bar plot. How can I adjust the the font
> size for the x-axis? Furthermore, I'm not sure what to write for 'at=?'. I
> tried cex.axis and cex.lab but still fail. Here is my data and code:
>
>> t(all)
> 0-100 100-150 150-200 200-250 250-300 300-350 350-400 400-620
> obs_data 382.000 177.000 156.0000 93.0 69.0000 45.000 14.0000 15.0000
> pre_gam 364.233 195.906 167.8515 95.1 63.2415 30.432 16.6425 17.5935
>
> bplt<- barplot(t(all), col=c("blue","yellow"),beside=TRUE,xlab="Rainfall (mm)",
> ylab="Frequency", main="Observed and predicted, Dec-Feb
> Beec",ylim=c(0,400))
> legend("topright",c("observed","predicted"),fill=c("blue","yellow"))
> axis(1, at =? , lab =
> c("0-100","100-150","150-200","200-250","250-300","300-350","350-400","400-620"),
> cex.axis = 0.5)
>
Hi Rosalina,
As Ivan said, you will first have to suppress the x axis in the initial
barplot. The return value of a barplot is the positions of the centers
of the bars, so:
axis(1,at=bplt,...)
Jim
More information about the R-help
mailing list