Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
How to highlight outliers in a boxplot in R?
To highlight outliers in a boxplot, we can create the boxplot with the help of Boxplot function of car package by defining the id.method.
For example, if we have a vector called V then the boxplot of V with highlighted outliers can be created by using the below given command −
Boxplot(~V,id.method="y")
Example 1
To highlight outliers in a boxplot, use the command given below −
library(car) xOutput
If you execute all the above given snippets as a single program, it generates the following output −
Example 2
To highlight outliers in a boxplot, use the command given below −
grpWarning message
In Boxplot.default(mf[[response]], x, id = list(method = id.method, −
NAs introduced by coercion
This warning message is displayed because format of the values might not be proper in Response vector but it does not make an impact on the boxplots so we can ignore it.
Output
If you execute all the above given snippets as a single program, it generates the following output −


