Increase border line thickness of ggplot2 plot in R
In this article, we are going to see how to change the borderline thickness using the ggplot2 bar plot in R Programming Language.
First, you need to install the ggplot2 package if it is not previously installed in R Studio. To install and load write the below command in R Console :
For creating a simple bar plot we will use the function geom_bar( ).
geom_bar(stat, fill, color, width)
- stat : Set the stat parameter to identify the mode.
- fill : Represents color inside the bars.
- color : Represents color of outlines of the bars.
- width : Represents width of the bars.
Let’s a Data Frame which has two vectors “match” and “run” and store it in a variable “runs”.
Increasing the Border Thickness
Inside the function geom_bar( ), use the keyword size and assign a value to change the thickness of the border. In our case, we have assigned a value of 2 to the size. We can observe that the thickness of the border line has increased.
Example 2: Consider a Data Frame which consists of information about marks obtained by students in an exam.