Move Axis Label Closer to Plot in Base R
In this article, we will discuss how to move the axis label closer to the plot in R Programming Language.
Before changing the distance, let us see how the initial plot will look like.
Method 1: Using line argument
In the above example simply add the title() function with line argument. To move axis labels closer to the axis pass appropriate value to the line argument.
Method 2: Using mgp()
The second way to achieve the same desired output will be to adjust the mgp values. The default value for distance between axis and axis name is 3. Reduce the value to reduce the distance between them.
mgp(title, labels, line margin )
- title margin line for the axis title and its default value is 3.
- labels margin line for the axis labels and its default value is 1.
- Line margin value for the axis line and its default line is 0.