[R] change y axis "distance"
Jim Lemon
jim at bitwrit.com.au
Tue Sep 21 13:38:50 CEST 2010
On 09/21/2010 08:55 PM, Joel wrote:
>
> Hi
>
> I got a barplot that has values between 0-150 and the y-axis shows the steps
> 0 50 100 and 150 but I would like to change it to 0 10 20 30... ...130 140
> 150
>
Hi Joel,
This is a combination of the "pretty" calculation of axis tick intervals
and the silent omission of labels that appear to be crowded. You can
probably get the fifteen labels by adding:
# set the axis labels to all horizontal text
par(las=1)
# add the yaxt argument to plot
plot(...,yaxt="n",...)
# display the axis
axis(2,at=seq(0,150,by=10),labels=seq(0,150,by=10))
If some of the labels are missing, you might have to turn to staxlab in
the plotrix package or a similar function.
Jim
More information about the R-help
mailing list