Adding label orientation
The orientation of the axis labels can be changed using the las attribute. The following specification symbols are used to specify the orientation :
0: always parallel to the axis
1: always horizontal
2: always perpendicular to the axis
3: always vertical.
Example: Adding label orientation
R
# creating a data frame data_frame <- data.frame (col1 = 1:20, col2 = 1:20, col3 = 1) # printing the data frame print ( "Original DataFrame" ) print (data_frame) # plotting a barplot barplot (data_frame$col2, names.arg = data_frame$col1 , las=3) |
Output
How to customize the axis of a Bar Plot in R
Barplots in R programming language can be created using the barplot() method. It takes as input a matrix or vector of values. The bar heights are equivalent to the values contained in the vector.
Syntax: barplot(H, xlab, ylab, main, names.arg, col)