Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Boxplots: Summarizing Distributions | Core Visualization Techniques in R
/
Essential R Data Visualization for Beginners

bookBoxplots: Summarizing Distributions

Deslize para mostrar o menu

Note
Definition

A boxplot is a standardized way of displaying the distribution of data based on a five-number summary: minimum, first quartile (Q1), median, third quartile (Q3), and maximum. The box shows the interquartile range (IQR), the line inside the box marks the median, and the "whiskers" extend to the smallest and largest values within 1.5 times the IQR from the quartiles. Points outside the whiskers are considered outliers.

Boxplots are especially useful when you want to quickly visualize the spread and symmetry of numeric data, spot outliers, and compare distributions across groups. Use a boxplot when you need to summarize the central tendency, variability, and skewness of your data in a compact form. Boxplots clearly reveal the median, the range covered by the middle 50% of the data (the box), and any values that fall well outside the typical range (outliers).

123
# Create a simple boxplot of numeric data data <- c(5, 7, 8, 9, 10, 12, 13, 15, 18, 21, 22, 25, 30) boxplot(data, main = "Boxplot of Sample Data", ylab = "Values")
copy

You can customize boxplots in R by changing colors, adding axis labels, and comparing groups side by side. Customizations help make your plots clearer and more informative. For example, you can use the col argument to set the box color, specify main, xlab, and ylab for titles and axis labels, and provide a grouping variable to compare multiple categories at once.

12345678
# Compare distributions of two groups using grouped boxplots group <- c(rep("A", 7), rep("B", 6)) values <- c(5, 7, 8, 9, 10, 12, 13, 15, 18, 21, 22, 25, 30) boxplot(values ~ group, main = "Boxplot by Group", xlab = "Group", ylab = "Values", col = c("skyblue", "orange"))
copy

Boxplots are a powerful tool for summarizing the distribution of numeric data and spotting outliers. They are especially valuable for comparing several groups at once, making them a staple for exploratory data analysis. By interpreting the box, whiskers, and outlier points, you can quickly assess the spread, central value, and unusual observations in your data.

1. What information does a boxplot provide?

2. How can you compare groups using boxplots?

3. What do the 'whiskers' in a boxplot represent?

question mark

What information does a boxplot provide?

Selecione a resposta correta

question mark

How can you compare groups using boxplots?

Selecione a resposta correta

question mark

What do the 'whiskers' in a boxplot represent?

Selecione a resposta correta

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 9

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Seção 1. Capítulo 9
some-alt