Summary
You can now choose a basic plot for a question, label it clearly, and interpret what the display does and does not show.
What you learned
| Plot | Useful for | Interpretation check |
|---|---|---|
| Histogram | The distribution of one numeric variable. | Bin boundaries affect the appearance. Counts or density must be labeled appropriately. |
| Density curve | A smoothed numeric distribution. | Bandwidth controls smoothness; the curve is an estimate, not individual observations. |
Cleveland dot chart (dotchart()) |
Comparing numeric values across named items or groups. | Ordering items can make comparisons easier. |
| Bar plot | Comparing category counts or other stated summaries. | Use table() for counts; explain what bar heights represent. |
| Box plot | Comparing numeric distributions across groups. | The center line is the median, not the mean. |
| Line chart | Changes over time or another ordered variable. | Sort the horizontal variable appropriately; connecting unrelated observations implies an order. |
| Pie chart | Category shares of a single whole. | Categories should be mutually exclusive parts of that whole; similar slices are hard to compare. |
| Scatterplot | A relationship between two numeric variables. | An association alone does not establish causation. |
Creating a readable plot
Use informative titles, axis labels, and units. Add a legend when colors or symbols encode groups. Functions such as points(), lines(), abline(), and legend() add to an existing plot; a new high-level call such as plot() starts a new plot. Check axis limits and whether missing observations were omitted. Choose colors and symbols that keep groups distinguishable.
A short recap in R
These illustrative measurements describe soil depth in centimeters. Run the calls separately to compare two views of the same values; in RStudio, use the Plots pane’s history arrows to move between them.
soil_depth_cm <- c(8, 9, 10, 10, 12, 13, 30)
hist(soil_depth_cm,
main = "Distribution of soil depth",
xlab = "Soil depth (cm)", ylab = "Frequency",
col = "lightblue")
boxplot(soil_depth_cm,
main = "Summary of soil depth",
ylab = "Soil depth (cm)", col = "lightblue")
The histogram shows frequencies in intervals. The box plot compresses the distribution into a median, box, whiskers, and separately drawn points. Here the median is 10 cm and the value 30 cm is plotted beyond the upper whisker. It should prompt investigation, not automatic deletion.
By default, R’s box plot box spans its lower and upper hinges, which summarize the lower and upper quarters of the data. Hinges can differ slightly from quantile() quartiles in small samples. Whiskers extend to the most extreme observations within 1.5 times the hinge spread from the box; they do not necessarily reach the minimum and maximum. Points beyond the whiskers are potential outliers, not proof of a measurement error.
Check your understanding
- Which plot would you choose for land-cover counts, a temperature time series, and the relationship between tree height and trunk diameter?
- Why can changing histogram bins or a density curve’s bandwidth change your impression of a distribution?
- What would you check in the source data before explaining a point beyond a box plot whisker?
Revisit plot creation, histograms and density, and box plots if needed.