How to show values in boxplot in R?

R ProgrammingServer Side ProgrammingProgramming

The main values in a boxplot are minimum, first quartile, median, third quartile, and the maximum, and this group of values is also called five-number summary. Therefore, if we want to show values in boxplot then we can use text function and provide the five-number summary and labels with fivenum function as shown in the below examples.

Example1

x<-sample(0:9,500,replace=TRUE)
boxplot(x,horizontal=TRUE) text(x=fivenum(x),labels=fivenum(x),y=1.25)

Output

Example2

y<-rpois(5000,10)
boxplot(y,horizontal=TRUE)
text(x=fivenum(y),labels=fivenum(y),y=1.25)

Output

raja
Updated on 06-Mar-2021 13:46:44

Advertisements