Plotting logarithmic X-axis
The log parameter can be set to display the axis and its corresponding values on the logarithmic scale. Setting the log value equivalent to character string x displays the modifications on the x-axis.
Example: Plotting logarithmic X-axis
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 , log = "x" ) |
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)