Page 256 - Data Science class 11
P. 256
barplot(H)
# Save the file
dev.off()
When you execute the above code, it produces the following result:
7.5.1 labels, title and colours Bar chart
The bar chart can be provided with more parameters. The main parameter is used to add a title. The col parameter is
used to add colours to the bars. The args.name is a vector having the same number of values as the input vector to
describe the meaning of each bar.
Enter the following code snippet in the script panel:
# Creating the data for the chart
H <- c(6,13,25,3,42)
M <- c("Mar","Apr","May","Jun","Jul")
# Giving the chart file a name
png(file = "barchart_months_revenue.png")
# Plotting the bar chart
barplot(H,names.arg=M,xlab="Month",ylab="Revenue",col="orange",
main="Monthwise Revenue chart",border="red")
# Saving the file
dev.off()
When you execute above code, it produces following result:
254 Touchpad Data Science-XI

