- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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 add a horizontal line in a boxplot created in base R?
A boxplot in base R already consists three horizontal lines that represents minimum, median, and the maximum but we might to create an extra horizontal to showcase some threshold value. For example, we might to create a horizontal line at 2 to understand the variation in values that are greater than say 2. This can be done very easily by using abline function after creating the boxplot.
Example1
> x<-rnorm(10) > boxplot(x) > abline(h=1)
Output:
Example2
> y<-rpois(500,10) > boxplot(y) > abline(h=15)
Output:
Example3
> z<-runif(500,2,10) > boxplot(z) > abline(h=3)
Output:
- Related Articles
- How to create a horizontal boxplot in base R?
- How to add a horizontal line to the plot created by ggplot2 in R?
- How to create a horizontal line in a histogram in base R?
- How to change the whisker line type in base R boxplot?
- How to change the border line type in base R boxplot?
- Create histogram with horizontal boxplot on top in base R.
- How to create a boxplot without frame in base R?
- How to create a rectangle inside boxplot in base R?
- How to add horizontal benchmark/target/base line in an Excel chart?
- How to create horizontal line for a range of values in a plot created by using ggplot2 in R?
- How to display mean inside boxplot created by using boxplot function in R?
- How to create boxplot for a list object in base R?
- How to hide outliers in base R boxplot?
- How to add a vertical line with some value on a scatterplot created by ggplot2 in R?
- How to add horizontal line in HTML?

Advertisements