How can I adjust only the size of Y-axis labels in R?
I know that cex.axis alters the size of the axis labels but it only affects the x-axis. Why, and how can I adjust the y axis?
ucfagls is right, providing you use the plot()
command. If not, please give us more detail.
In any case, you can control every axis seperately by using the axis()
command and the xaxt
/yaxt
options in plot()
. Using the data of ucfagls, this becomes :
plot(Y ~ X, data=foo,yaxt="n")
axis(2,cex.axis=2)
the option yaxt="n" is necessary to avoid that the plot command plots the y-axis without changing. For the x-axis, this works exactly the same :
plot(Y ~ X, data=foo,xaxt="n")
axis(1,cex.axis=2)
See also the help files ?par and ?axis
Edit : as it is for a barplot, look at the options cex.axis and cex.names :
tN <- table(sample(letters[1:5],100,replace=T,p=c(0.2,0.1,0.3,0.2,0.2)))
op <- par(mfrow=c(1,2))
barplot(tN, col=rainbow(5),cex.axis=0.5) # for the Y-axis
barplot(tN, col=rainbow(5),cex.names=0.5) # for the X-axis
par(op)