
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Create Horizontal Lines for Each Bar in a Bar Plot of Base R
To create horizontal lines for each bar in a bar plot of base R, we can use abline function and pass the same values as in the original barplot with h argument that represents horizontal with different color to make the plot a little better in terms of visualization.
Example
x<-c(24,25,22) barplot(x) abline(h=c(24,25,22),col="red")
Output
Example2
y<-rpois(5,2) y
Output
[1] 4 0 2 2 4
Example
barplot(y) abline(h=c(4,0,2,2,4),col="blue")
Output
Advertisements