| Create Bar Charts in R Language?
First we will discuss what is bar chart. A bar chart is created by rectangle bars to display data. we can display bar charts horizontal or vertical. Length and height of the bars are proportional to the values they represent. We use barplot() function to draw a vertical bar chart. Below is the example for bar charts values:-
#x-axis Values as given below
x<- c("A","B","C","D")
#y-axis Values as given below
y<- c(2,4,6,8)
barplot(y,companyname.arg=x)
In above example below are some points
(1)x variable represent values on x-axis(A,B,C,D)
(2)y variable represent values on y-axis(2,4,6,8)
(3)We use barplot() function to create bar chart of values
(4)companyname.arg defines name of each oberservation on x-axis | | |