Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Boxplots for Summarizing Data | Section
Information Visualization with ggplot2 in R

bookBoxplots for Summarizing Data

Glissez pour afficher le menu

Boxplots are a powerful way to summarize and compare the distribution of numeric data across one or more categories. A boxplot provides a compact visual summary that displays several important statistics: the median, the first and third quartiles (Q1 and Q3), and potential outliers. The central box represents the interquartile range (IQR), which covers the middle 50% of the data. The line inside the box marks the median, or the 50th percentile. The "whiskers" extend from the box to the smallest and largest values within 1.5 times the IQR from the lower and upper quartiles, respectively. Points beyond the whiskers are considered outliers and are often plotted individually.

12345678910111213141516171819
# Load the ggplot2 package library(ggplot2) # Example data: scores of students in different classes data <- data.frame( class = rep(c("A", "B", "C"), each = 20), score = c( rnorm(20, mean = 75, sd = 10), rnorm(20, mean = 80, sd = 12), rnorm(20, mean = 70, sd = 8) ) ) # Create a boxplot of scores grouped by class ggplot(data, aes(x = class, y = score)) + geom_boxplot() + labs(title = "Boxplot of Student Scores by Class", x = "Class", y = "Score")
copy

When you interpret a boxplot, you can quickly compare the medians between groups, assess the spread of the data within each group, and identify possible outliers. A longer box or whiskers indicate greater variability, while a shorter box suggests the data are more tightly clustered. Outliers, shown as individual points beyond the whiskers, may represent unusual observations or measurement errors. Comparing boxplots side by side helps you understand differences in central tendency, spread, and the presence of outliers among categories.

question mark

Which of the following statements about boxplots is correct?

Sélectionnez la réponse correcte

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 5

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

Section 1. Chapitre 5
some-alt