Biostatistics • Descriptive Statistics & Visualization

Choosing Plots — Choose appropriate plots (histogram, boxplot, bar chart)

Selecting the right visualization transforms raw biostatistical data into actionable insight and honest communication.

A scatter plot connecting biological data with a DNA strand and health signal.
Inside this lesson 10 sections 5 questions 8 figures

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

Scottish engineer William Playfair published The Commercial and Political Atlas, introducing the bar chart to compare categorical quantities such as trade balances between nations. This single innovation established the principle that length or height could encode magnitude for discrete categories.

1891 • Karl Pearson Formalizes the Histogram

Pearson coined the term 'histogram' and developed it as a tool for visualizing the frequency distribution of continuous measurements. His work at University College London linked the histogram to emerging probability theory, making it indispensable for understanding how biological variables are distributed across a population.

1970 • John Tukey Introduces the Box-and-Whisker Plot

In his landmark work on exploratory data analysis (EDA), Tukey proposed the boxplot as a compact five-number summary. The design foregrounded the median, spread, and potential outliers—critical features for comparing groups in clinical and epidemiological research.

1983 • Tufte's Visual Display of Quantitative Information

Edward Tufte articulated principles of graphical integrity—data-ink ratio, lie factor, and chart-junk avoidance—that formalized the criteria for choosing among plot types. His work underscored that an inappropriate chart can systematically mislead, a concern especially acute in biomedical publications.

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.

1

Match Scale to Geometry

Continuous variables (e.g., blood pressure, serum cholesterol) call for plots whose axes represent a continuum—histograms and boxplots. Categorical variables (e.g., disease status, treatment arm) call for discrete visual elements—bars separated by gaps.
2

Distribution vs. Summary

A histogram shows the full shape of a distribution (skewness, modality, tails), while a boxplot compresses that shape into a five-number summary. Choosing between them involves a trade-off between detail and compactness.
3

Comparison Across Groups

When the goal is to compare distributions of a continuous variable across two or more groups (e.g., treatment vs. placebo), side-by-side boxplots are typically superior to overlapping histograms, which become cluttered beyond two groups.
4

Frequency vs. Proportion

Bar charts display counts or proportions of categorical outcomes. Unlike histograms, their bars are separated by whitespace to reinforce the discrete nature of the categories, and the order of bars can be rearranged without loss of meaning for nominal data.
5

Audience and Convention

Biomedical journals follow CONSORT, STROBE, or EQUATOR guidelines that specify preferred visualizations. Understanding field conventions ensures your plots are interpretable by peer reviewers and clinicians alike.
✦

KEY TAKEAWAY

Think of plot selection like choosing the right lens for a microscope. A low-power objective gives you the overview of a tissue section (bar chart summarizing categories), a medium-power lens reveals cellular architecture (boxplot summarizing distribution shape), and a high-power lens shows individual cell morphology (histogram revealing every bump and tail). No single lens is 'best'—the question is what you need to see.

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.

HistogramBoxplotBar Chart(Continuous: SBP mmHg)(Continuous: SBP mmHg)(Categorical: Diagnosis)01530456090110130150SBP (mmHg)Frequency90110130150170MedianQ1WhiskerOutliersWhiskerSBP (mmHg)020406080HTNDMCKDDiagnosisCountTouching bars → continuousFive-number summarySeparated bars → categorical
Left: a histogram of systolic blood pressure with touching bars indicating a continuous scale. Center: a boxplot of the same variable, annotated with its five-number summary components and outlier markers. Right: a bar chart of patient counts by diagnosis category, with gaps between bars signaling discrete categories.

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

k=⌈log2(n)+1⌉k = ⌈log₂(n) + 1⌉

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

h=2×IQR×n−1ᐟ3h = 2 × IQR × n⁻¹ᐟ³

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

Min,Q1,Median,Q3,Max{Min, Q1, Median, Q3, Max}

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

Do not use a bar chart for continuous data or a histogram for categorical data. A 'histogram' of blood types would imply a continuous ordering from A to O that does not exist, while a 'bar chart' of cholesterol values would collapse important distributional information.

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.

What type is your variable?ContinuousCategoricalContinuous VariableCategorical VariableWhat is your goal?Show shapeCompare groupsHISTOGRAM1 group, full shapeBOXPLOT≥2 groups, compactDisplay counts or proportionsBAR CHARTCategorical countsAlso consider: density plot,violin plot (hybrid)Also consider: violin plot,jitter/strip chartAlso consider: pie chart(only for parts of a whole)Key rule: the measurement scale of your variable determines which family of plots is appropriate.
A decision flowchart for selecting among histograms, boxplots, and bar charts. Begin at the top with the measurement scale of your primary variable, then follow the branches to the recommended plot. Dashed lines indicate related alternatives worth considering in specialized contexts.
CriterionHistogramBoxplotBar Chart
Variable typeContinuous (interval/ratio)Continuous (interval/ratio)Categorical (nominal/ordinal)
Primary purposeDisplay distribution shape, modality, skewCompare medians, spread, and outliers across groupsCompare counts or proportions across categories
Bars touching?Yes — continuous axisN/A (box glyph)No — gaps signal discrete categories
Best # of groups1 (overlay ≤ 2 with transparency)2–10+ side by side2–15 categories
Outlier detectionVisible in tails, but not flaggedExplicitly marked as individual pointsNot 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. 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. 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. 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. 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. 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 TypeStrengthsLimitations
HistogramReveals 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.
BoxplotCompact 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 ChartClear 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

Think of the dynamite plot (bar + error bar for continuous data) as taking a perfectly good photograph and replacing it with a stick figure. The bar conveys only the mean, the error bar conveys only one measure of spread, and every other feature—shape, outliers, sample size—is lost. Whenever you are tempted to summarize continuous data with bars, reach for a boxplot or violin plot instead.

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 PlotAdvanced ExtensionWhen to Upgrade
HistogramKernel Density Estimate (KDE)When you need a smooth estimate of the probability density function and want to overlay multiple groups without bin artifacts.
BoxplotViolin PlotWhen you need both the five-number summary and the distributional shape; violin plots overlay a mirrored KDE on a central box.
BoxplotRaincloud PlotWhen you want raw data points (jittered), a boxplot summary, and a half-KDE in a single panel—ideal for small-to-moderate n.
Bar ChartStacked / Grouped Bar ChartWhen a second categorical variable (e.g., sex within treatment arm) must be visualized simultaneously.
Bar ChartMosaic PlotWhen 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

A researcher wants to visualize the distribution of body mass index (BMI) for 500 adults enrolled in a cohort study, specifically checking for bimodality that might suggest the presence of two distinct subpopulations. Should she use a histogram, a boxplot, or a bar chart? Explain your reasoning.
Show answer
She should use a histogram. BMI is a continuous, ratio-scale variable, which rules out the bar chart (designed for categorical data). While a boxplot can display the median, quartiles, and outliers, it cannot reveal bimodality—two modes would produce the same five-number summary as a unimodal distribution with similar spread. Only the histogram shows the full shape of the distribution, making it possible to visually identify a second peak. With n = 500, the Freedman–Diaconis rule will yield a reasonable bin width that preserves distributional detail without excessive noise.

Question 2: BASIC CALCULATION

A sample of n = 80 serum creatinine values has an IQR of 0.6 mg/dL. Using the Freedman–Diaconis rule (h = 2 × IQR × n⁻¹ᐟ³), compute the recommended bin width for a histogram. If the data range from 0.4 to 2.8 mg/dL, how many bins result?
Show answer
First compute n−1/3: 801/3 ≈ 4.309, so 80−1/3 ≈ 0.2321. Then h = 2 × 0.6 × 0.2321 ≈ 0.279 mg/dL. Rounding to a convenient value gives h ≈ 0.3 mg/dL. The data range is 2.8 − 0.4 = 2.4 mg/dL, so the number of bins is ⌈2.4 / 0.3⌉ = 8 bins. This is a reasonable number of bins for n = 80, providing enough resolution to discern the distributional shape without overfitting to noise.

Question 3: INTERMEDIATE

You have hemoglobin A1c (HbA1c) measurements for patients in four treatment arms (n ≈ 40 per arm). Your collaborator suggests overlaying four color-coded histograms in a single panel. What are the problems with this approach, and what would you recommend instead?
Show answer
Overlaying four histograms creates severe visual clutter: bars from different groups overlap and occlude each other, making it difficult to read frequencies for any single arm, especially the groups plotted 'behind' others. Even with transparency (alpha blending), four overlapping histograms become a murky composite. The recommended alternative is side-by-side boxplots (one per arm), which compactly display medians, spreads, and outliers for all four groups without overlap. If distributional shape is essential (e.g., testing for bimodality), consider violin plots or a faceted histogram panel (small multiples with one histogram per arm sharing the same x-axis), which preserves shape information while avoiding overlap.

Question 4: APPLIED

A clinical research coordinator presents the following figure in a draft manuscript: a bar chart where the x-axis shows BMI ranges (18.5–24.9, 25.0–29.9, 30.0–34.9, 35.0–39.9, ≥40.0) and the y-axis shows patient count. The bars are separated by gaps. Is this plot appropriate? If not, what changes would you make and why?
Show answer
This plot is technically a histogram masquerading as a bar chart. BMI is a continuous variable, and the x-axis categories are contiguous numeric intervals (bins), not unordered discrete categories. By separating the bars with gaps, the figure falsely implies that these BMI ranges are independent categories with no numeric relationship. The correct fix is to remove the gaps between bars so the touching bars communicate the continuous nature of the x-axis. Additionally, the x-axis should be labeled as a true numeric scale rather than text-based categories. If unequal bin widths are used (e.g., the last bin is open-ended, ≥40), the y-axis should represent frequency density rather than raw count, so that bar area—not height alone—is proportional to frequency. This avoids exaggerating the apparent frequency in wider bins.

Question 5: CRITICAL THINKING

A colleague argues that boxplots are always superior to histograms because they are more compact and facilitate group comparisons. Construct a counterargument by describing a specific biostatistical scenario in which a boxplot would be misleading and a histogram essential. Include a discussion of what distributional feature the boxplot would hide.
Show answer
Consider a study measuring C-reactive protein (CRP) levels in a population that includes both healthy individuals and those with active infections. The CRP distribution is likely bimodal—one mode near 1 mg/L (healthy) and another near 50 mg/L (infected). A boxplot of these data would show a box spanning roughly 1 to 50 mg/L with a median somewhere in between, perhaps with a few extreme outliers. Critically, it would look almost identical to a unimodal right-skewed distribution with the same quartiles; the bimodal structure is invisible in the five-number summary. A histogram, by contrast, would clearly display two peaks, immediately suggesting a mixture of subpopulations—a finding with direct clinical significance (e.g., the need to stratify by infection status). This scenario illustrates that compactness comes at the cost of information: whenever distributional shape—modality, gaps, or irregular tails—is the feature of scientific interest, the histogram is indispensable.

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.

Varsity Tutors • Biostatistics • Choosing Plots — Choose appropriate plots (histogram, boxplot, bar chart)