- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a horizontal line in a histogram in base R?
A horizontal line in a histogram is not much useful but we might want to create it in some situations such as where we want to display a specific value on the Y-axis that helps us to differentiate in the density of frequencies above or below a certain value. To create a horizontal line in a histogram, we simply need to use abline function as shown in the below example
Example
> x<-rnorm(1000) > hist(x) > abline(h=100)
Output
Example
> abline(h=100,col="blue")
Output
Example
> abline(h=100,col="blue",lwd=5)
Output
- Related Articles
- How to create horizontal histogram in R?
- Create histogram with horizontal boxplot on top in base R.
- How to create a horizontal boxplot in base R?
- How to create a histogram without bins in base R?
- How to add a horizontal line in a boxplot created in base R?
- How to create horizontal line for Y variable at median in base R plot?
- How to create a histogram with dots instead of bars in base R?
- How to create a dashed horizontal line in a ggplot2 graph in R?
- How to create horizontal line in xyplot in R?
- How to highlight a bar in base R histogram?
- How to create a plot with dashed regression line in base R?
- How to create a horizontal line in ggplot2 graph with larger width in R?
- How to create a horizontal line in ggplot2 graph with different color in R?
- How to create a vertical line in a time series plot in base R?
- How to create a histogram using weights in R?

Advertisements