- 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 display mean inside boxplot created by using boxplot function in R?

A boxplot shows the median as a measure of center along with other values but we might want to compare the means as well. Therefore, showing mean with a point is likely to be preferred if we want to compare many boxplots. This can be done by using points(mean(“Vector_name”)), if we are plotting the columns of an R data frame then we will reference them instead of vector name.

## Example

Consider the below data and the boxplot −

x<-runif(100,2,5) boxplot(x)

## Output

Adding mean point to the boxplot −

## Example

points(mean(x),col="red")

## Output

- Related Articles
- How to change the X-axis labels for boxplots created by using boxplot function in R?
- How to plot means inside boxplot using ggplot2 in R?
- How to display mean in a boxplot with cross sign in base R?
- How to change the Y axis limit for boxplot created by using ggplot2 in R?
- How to create boxplot using mean and standard deviation in R?
- How to increase the width of the lines in the boxplot created by using ggplot2 in R?
- How to create a rectangle inside boxplot in base R?
- How to display star for significance in base R boxplot?
- How to add a horizontal line in a boxplot created in base R?
- How to italicize boxplot label in R using ggplot2?
- How to display outliers in boxplot with different shape in base R?
- How to change the order of boxplot by means using ggplot2 in R?
- How to create side-by-side boxplot in base R?
- How to create boxplot using ggplot2 without whiskers in R?
- How to create transparent boxplot in R?

Advertisements