SECTION 1
Historical Context & Motivation
The impulse to visualize numerical data is centuries old, yet the specific chart types that dominate modern biostatistics each arose from distinct intellectual traditions. Before the eighteenth century, researchers presented results almost exclusively in tables—dense grids of numbers that taxed the reader's ability to detect patterns. The birth of statistical graphics coincided with the Enlightenment's emphasis on empirical evidence and the growing need to summarize large observational datasets in medicine, demography, and the natural sciences. Understanding why histograms, boxplots, and bar charts were invented illuminates the specific analytical questions each one is designed to answer—and why choosing the wrong plot can obscure rather than reveal patterns in biological data.
1786 • William Playfair Invents the Bar Chart
1891 • Karl Pearson Formalizes the Histogram
1970 • John Tukey Introduces the Box-and-Whisker Plot
1983 • Tufte's Visual Display of Quantitative Information
The central question this lesson addresses is deceptively simple: given a particular dataset and research question in biostatistics, which plot type conveys the most honest, complete, and useful picture of the data? Answering that question requires understanding what each visualization encodes, what it omits, and how it interacts with the measurement scale and distributional properties of the variable at hand.
SECTION 2
Core Principles of Plot Selection
Choosing the appropriate plot is not a matter of aesthetic preference; it is determined by the intersection of three structural features of your data: the measurement scale (nominal, ordinal, interval, or ratio), the number and type of variables being displayed, and the analytical intent of the visualization—whether you aim to show a distribution, compare groups, or summarize counts. The following foundational ideas guide every plot-selection decision in biostatistics.
Match Scale to Geometry
Distribution vs. Summary
Comparison Across Groups
Frequency vs. Proportion
Audience and Convention
KEY TAKEAWAY
SECTION 3
Visual Comparison of Plot Types
The diagram below places the three core plot types side by side, each applied to a hypothetical clinical dataset. On the left, a histogram displays the distribution of systolic blood pressure (a continuous variable) for 200 patients, revealing right skew and a possible secondary mode. In the center, a boxplot of the same variable condenses the distribution into its median, interquartile range, whiskers, and outliers—sacrificing distributional detail for compactness and easy group comparison. On the right, a bar chart tallies patients across categorical diagnosis groups, with separated bars reinforcing the discrete nature of the variable.
Notice three critical visual cues in the diagram. First, the histogram's bars are touching—this communicates that the x-axis is a continuous number line and that each bar spans a numeric interval (bin). Second, the boxplot compresses the entire distribution into a single glyph, making it ideal for side-by-side group comparisons without the visual clutter of overlapping histograms. Third, the bar chart's bars are separated by whitespace, signaling that the categories (HTN, DM, CKD) have no inherent numeric order and could be rearranged without altering the message.
SECTION 4
How Each Plot Encodes Data
Although choosing a plot is largely a design decision, quantitative considerations govern how each chart transforms raw data into visual marks. Understanding the mathematics behind bin width selection, quartile computation, and bar height scaling ensures that the plots you produce are statistically faithful and not artifacts of arbitrary parameter choices.
Histogram: Bin Width and Frequency Density
STURGES' RULE FOR BIN COUNT
where k = number of bins, n = sample size, and ⌈·⌉ denotes the ceiling function. Sturges' rule assumes approximate normality and works well for moderate sample sizes (n < 200). For larger or heavily skewed datasets, the Freedman–Diaconis rule is preferred.
FREEDMAN–DIACONIS BIN WIDTH
where h = bin width, IQR = interquartile range (Q3 − Q1), and n = sample size. This rule is robust to skew because it uses the IQR rather than the standard deviation.
Boxplot: Five-Number Summary
FIVE-NUMBER SUMMARY
The box spans Q1 to Q3 (the interquartile range); the line inside marks the median. Whiskers typically extend to the most extreme data point within 1.5 × IQR of the nearer quartile. Points beyond the whiskers are plotted individually as potential outliers.
Bar Chart: Encoding Counts or Proportions
A bar chart maps each level of a categorical variable to a bar whose height (or length) equals the count or relative frequency of that level. Unlike a histogram, where the area of the bar encodes frequency density, in a bar chart it is the height alone that encodes magnitude, because all bars share the same width. This distinction matters: if you use unequal bin widths in a histogram, you must plot frequency density (count / bin width) on the y-axis so that area remains proportional to frequency.
Common Pitfall
SECTION 5
Decision Flowchart for Plot Selection
The following flowchart formalizes the decision-making process that experienced biostatisticians use intuitively. Starting from the type of variable on the x-axis, the chart branches through analytical intent—whether you seek to display a distribution, compare groups, or summarize frequencies—and terminates at the recommended plot type. While real-world decisions involve additional nuances (sample size, audience, publication standards), this flowchart covers the foundational logic.
| Criterion | Histogram | Boxplot | Bar Chart |
|---|---|---|---|
| Variable type | Continuous (interval/ratio) | Continuous (interval/ratio) | Categorical (nominal/ordinal) |
| Primary purpose | Display distribution shape, modality, skew | Compare medians, spread, and outliers across groups | Compare counts or proportions across categories |
| Bars touching? | Yes — continuous axis | N/A (box glyph) | No — gaps signal discrete categories |
| Best # of groups | 1 (overlay ≤ 2 with transparency) | 2–10+ side by side | 2–15 categories |
| Outlier detection | Visible in tails, but not flagged | Explicitly marked as individual points | Not applicable |
Decision matrix for selecting among the three core plot types in biostatistics.
SECTION 6
Worked Example: Choosing and Constructing Plots
Suppose you are analyzing data from a clinical trial comparing fasting blood glucose (FBG) levels across three treatment arms: Placebo (n = 50), Drug A (n = 50), and Drug B (n = 50). You also have data on each patient's diabetes classification (Type 1, Type 2, or Pre-diabetic). Your task is to select the most appropriate plot for each analysis question.
Selecting and Justifying the Right Plot
- 1
Step 1 — Identify the Variable and Measurement Scale
Fasting blood glucose (FBG) is measured in mg/dL—a continuous, ratio-scale variable. Diabetes classification is a categorical, nominal variable with three unordered levels. This distinction immediately determines which plot families are candidates: histograms and boxplots for FBG, and a bar chart for diabetes classification.FBG → continuous → histogram or boxplot; Classification → categorical → bar chart - 2
Step 2 — Define the Analytical Intent
If the goal is to examine the overall shape of the FBG distribution in the entire sample—checking for normality, skewness, or bimodality—a histogram is ideal. If instead the goal is to compare the FBG distributions across the three treatment arms, then plotting three overlapping histograms would become cluttered; side-by-side boxplots provide a far cleaner comparison.Single-group distribution → histogram; Multi-group comparison → boxplot - 3
Step 3 — Determine Bin Width for the Histogram
With n = 150 total patients and the Freedman–Diaconis rule, suppose the IQR of FBG is 40 mg/dL. Then h = 2 × 40 × 150−1/3 ≈ 2 × 40 × 0.1882 ≈ 15.1 mg/dL. Rounding to a convenient value, we choose a bin width of 15 mg/dL. With a data range from roughly 70 to 250 mg/dL, this yields approximately 12 bins—sufficient resolution without excessive noise.Bin width ≈ 15 mg/dL → ~12 bins across the observed range - 4
Step 4 — Construct the Boxplot Comparison
For side-by-side boxplots, compute the five-number summary for each arm. Suppose Placebo: {78, 100, 120, 145, 230}, Drug A: {72, 92, 108, 128, 195}, Drug B: {68, 85, 98, 115, 165}. Each box spans Q1 to Q3 with a median line. Whiskers extend to the most extreme observation within 1.5 × IQR of Q1 or Q3. For the Placebo arm, IQR = 145 − 100 = 45, so the upper whisker limit is 145 + 1.5 × 45 = 212.5. Since the max is 230 > 212.5, 230 is plotted as an outlier.Placebo outlier at 230 mg/dL; Drug B shows the lowest median and smallest spread - 5
Step 5 — Construct the Bar Chart for Diabetes Classification
Count the number of patients in each classification: Type 1 = 35, Type 2 = 80, Pre-diabetic = 35. Create three bars with gaps between them. The y-axis represents count (or proportion if standardized to 100%). Bar order is arbitrary for nominal data, though convention might place them alphabetically or by clinical severity.Bar chart with three separated bars; Type 2 has the tallest bar (80 patients)
SECTION 7
Strengths, Limitations, and Common Misuses
Each plot type has inherent trade-offs. A well-chosen visualization maximizes information transfer while minimizing cognitive load and potential for misinterpretation. The table below synthesizes the key strengths and limitations of each plot, followed by frequent misuses encountered in biomedical literature.
| Plot Type | Strengths | Limitations |
|---|---|---|
| Histogram | Reveals full distributional shape: skewness, kurtosis, modality, gaps, and outliers. Intuitive for audiences unfamiliar with statistical summaries. | Sensitive to bin width choice; different widths can suggest different shapes. Difficult to compare more than 2 groups simultaneously. Does not show individual data points. |
| Boxplot | Compact five-number summary; excellent for side-by-side comparison of many groups. Explicitly flags outliers. Robust to extreme values. | Hides distributional shape (bimodality invisible). Cannot reveal sample size without annotation. May mislead when distributions are multimodal. |
| Bar Chart | Clear representation of categorical frequencies. Easy to read and compare across levels. Universally understood by non-technical audiences. | Inappropriate for continuous data. Can mislead if y-axis does not start at zero (truncated axis inflates differences). Offers no distributional information. |
Comparative strengths and limitations of the three core plot types.
Common Misuses in Biomedical Literature
- Dynamite plots (bar charts with error bars) used to display continuous outcomes—these hide the distribution and can obscure bimodality, outliers, and sample size. Replace with boxplots, violin plots, or dot plots.
- Histograms for small samples (n < 20)—with so few observations, the histogram is dominated by bin-width artifacts. Use a dot plot or stem-and-leaf display instead.
- Pie charts for many categories—humans judge angles poorly; a bar chart outperforms a pie chart when comparing more than three or four categories.
- 3-D effects and chart-junk—three-dimensional bar charts distort area perception and violate Tufte's data-ink ratio principle. Always use flat, two-dimensional plots.
KEY TAKEAWAY
SECTION 8
Connection to Advanced Visualization
The histogram, boxplot, and bar chart form the foundation of data visualization in biostatistics, but modern practice extends these primitives in several important directions. Understanding these extensions reveals the trajectory from introductory visualization to the sophisticated graphics encountered in peer-reviewed biomedical research, particularly in genomics, epidemiology, and clinical trial reporting.
| Basic Plot | Advanced Extension | When to Upgrade |
|---|---|---|
| Histogram | Kernel Density Estimate (KDE) | When you need a smooth estimate of the probability density function and want to overlay multiple groups without bin artifacts. |
| Boxplot | Violin Plot | When you need both the five-number summary and the distributional shape; violin plots overlay a mirrored KDE on a central box. |
| Boxplot | Raincloud Plot | When you want raw data points (jittered), a boxplot summary, and a half-KDE in a single panel—ideal for small-to-moderate n. |
| Bar Chart | Stacked / Grouped Bar Chart | When a second categorical variable (e.g., sex within treatment arm) must be visualized simultaneously. |
| Bar Chart | Mosaic Plot | When you wish to display the joint distribution of two categorical variables and assess their independence visually. |
How foundational plot types evolve into advanced visualizations.
As you progress into courses on multivariate analysis, survival analysis, and high-dimensional data (e.g., RNA-seq heatmaps), the logic of plot selection scales: always begin by identifying measurement scales and analytical intent, then select the geometry that most faithfully encodes the relevant features of the data. The principles you have learned here—continuous → histogram or boxplot, categorical → bar chart, comparison → compact glyph—remain the bedrock on which every advanced visualization is built.
SECTION 9
Practice Problems
Question 1: CONCEPTUAL
Show answer
Question 2: BASIC CALCULATION
Show answer
Question 3: INTERMEDIATE
Show answer
Question 4: APPLIED
Show answer
Question 5: CRITICAL THINKING
Show answer
SUMMARY
Lesson Summary
Summary
Selecting the right plot in biostatistics begins with identifying the measurement scale of your variable. Continuous variables (blood pressure, glucose, BMI) are displayed with histograms when the goal is to reveal the full distributional shape—skewness, modality, and tails—or with boxplots when comparing the median, spread, and outliers across multiple groups. Categorical variables (diagnosis, treatment arm, genotype) are displayed with bar charts whose separated bars reinforce the discrete, unordered nature of the categories.
Key decision heuristics include: histograms have touching bars (continuous axis), bar charts have separated bars (discrete categories), and boxplots compress a distribution into its five-number summary for efficient multi-group comparison. Avoid the dynamite plot (bar + error bar) for continuous outcomes—it obscures distributional features. As you advance, extend these foundational plots to kernel density estimates, violin plots, and raincloud plots for richer, more nuanced data communication.