rotating axis labels in R

R Programming

In R, how do I make a (bar)plot's y-axis labels parallel to the X-axis instead of parallel to the Y axis?



You should use las, which indicates the orientation of the labels and any other text used on the plot. It will be set to 0 by default, which means the labels will always be parallel to the axis. You can change it to the following options.

0 = always parallel to the axis

1 = always horizontal

2 = always perpendicular to the axis

3 = always vertical

Here is an example that shows the labels in a horizontal style.


TableData <- table(Ni <- stats::rpois(50, lambda=2))

BarChart <- barplot(TableData, col=10, las=1)



If you want to unleash your potential in this competitive field, please visit the R Programming course page for more information, where you can find the R Programming tutorials and R Programming frequently asked interview questions and answers as well.


This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.