Start With the Question and the Variables
A useful plot begins with a clear question about how an outcome varies with a predictor. For example, a researcher might ask whether a measured health outcome differs by treatment group, or how an outcome changes as a measured dose increases. These questions both involve a predictor and a response, but the predictor is not the same type in each case. The type of the predictor is the first guide to choosing a plot.
In this tutorial, the response is quantitative: it is a measurement or count for which numerical differences are meaningful. The predictor may be quantitative, such as elapsed time or dose, or categorical, such as assigned treatment or type of equipment. The goal here is to choose a display that suits those variable types, not to decide whether an apparent pattern is statistically significant or causal.
Before choosing a plot, check that each row represents one observational unit and that the predictor and response values in a row belong together. Also check that the response is quantitative, as assumed here, and identify whether the predictor is quantitative or categorical. No probability model is required just to make this choice. The decision is about what the data are and which features the display should show.
A Plot-Choice Guide
When both variables are quantitative, each observation is a paired numerical value. A scatterplot displays one point for each pair: the predictor is on the horizontal axis and the response is on the vertical axis. This preserves the individual observations and their pairing.
When the predictor is categorical and the response is quantitative, observations fall into separate groups. A grouped distribution plot displays the response values within each predictor category. A strip plot can show the individual values; a box plot provides a compact display of a distribution. A summary plot instead shows a group-level summary, such as a mean or median, for each category. It can make comparisons of group centers concise, but it does not show all the individual responses.
| Predictor | Response | Useful starting plot | What it emphasizes |
|---|---|---|---|
| Quantitative | Quantitative | Scatterplot | Individual paired values across the predictor’s numerical range |
| Categorical | Quantitative | Grouped distribution plot | Individual values or the distributions within categories |
| Categorical | Quantitative | Summary plot | A selected group summary, such as a mean or median |
A summary plot is not a different answer to the question of variable type. It is an alternative way to display categorical groups when the comparison of interest is a group summary. If the amount of within-group variation or the presence of unusual observations matters, a distribution plot is often more informative. If a concise comparison of group centers is the main goal, a summary plot may be easier to read. The choice depends on the purpose, and a summary should not be mistaken for the full data.
Worked Example: Quantitative Predictor and Response
Suppose, in a hypothetical laboratory demonstration, a technician records the assigned solution concentration in milligrams per litre and a measured response in millimetres for six samples. The recorded pairs are (0, 12), (1, 14), (2, 15), (3, 18), (4, 19), and (5, 22). Which plot should be used to show these data?
The predictor is solution concentration, a quantitative variable measured in milligrams per litre. The response is the measured outcome, also quantitative, measured in millimetres. The observations are paired: each response belongs to the concentration recorded for that sample.
Use a scatterplot with concentration on the horizontal axis and response on the vertical axis. The plotted points are \((0,12)\), \((1,14)\), \((2,15)\), \((3,18)\), \((4,19)\), and \((5,22)\). The horizontal axis should be labelled “Concentration (mg/L)” and the vertical axis “Response (mm).”
A grouped plot would require turning the numerical concentrations into categories, which would discard their meaningful numerical spacing. The scatterplot is the direct display because both variables are quantitative and the pairing of each sample’s measurements matters.
Worked Example: Categorical Predictor and Individual Outcomes
In a hypothetical evaluation, four plants are assigned to each of two nutrient treatments. Their measured heights after a fixed period, in centimetres, are:
| Treatment A | Treatment B |
|---|---|
| 12 | 10 |
| 15 | 13 |
| 15 | 14 |
| 18 | 19 |
The predictor is treatment, which is categorical: “A” and “B” label groups and do not represent numerical distances. The response is plant height, which is quantitative and measured in centimetres. If the aim is to compare the observed outcomes while retaining the plants’ individual measurements, choose a grouped distribution plot.
For example, a strip plot would place the four heights for Treatment A above the A category and the four heights for Treatment B above the B category. Each value is still visible: 12, 15, 15, and 18 cm for A; 10, 13, 14, and 19 cm for B. The plot groups observations by treatment rather than giving the treatment labels an artificial numerical scale.
A summary plot could be used if the question specifically calls for a compact comparison of group centers. But showing only one center per treatment would hide the fact that the individual heights vary, including the different ranges visible in the listed values. Since this example asks to inspect the observed outcomes, the grouped distribution plot is the better starting choice.
Worked Example: When a Summary Plot Is the Focus
Consider a different hypothetical data set of test scores, in points, from three students in each of three instructional groups. The scores are: Group A, 70, 80, and 90; Group B, 75, 78, and 81; Group C, 60, 85, and 95. The predictor is instructional group (categorical), and the response is score (quantitative). Suppose the immediate aim is to compare the group means.
A summary plot showing one mean for each group matches that aim. The mean for a group is the sum of its scores divided by its number of scores. For Group A:
For Group B and Group C, the corresponding calculations are:
The summary plot would place the group labels A, B, and C on the horizontal axis and the mean score, in points, on the vertical axis. Its plotted summaries would be 80, 78, and 80 points, respectively. This display makes the requested comparison of means direct. However, the three means do not reveal the score patterns within groups: for instance, Group C’s scores range from 60 to 95 points. A grouped distribution plot would be preferable if that variation is also important to the question.
A Short Justification for the Choice
The key distinction is whether horizontal position should represent a numerical value or a group label. For quantitative predictor values \(x_i\) and quantitative responses \(y_i\), the observations are pairs \((x_i,y_i)\). A scatterplot maps each pair to one location, so it retains both measurements and their association at the level of individual observations.
For a categorical predictor, let \(g_i\) denote the category for observation \(i\). There is no meaningful numerical distance between labels such as “A” and “B.” Instead, the plot assigns observations to their categories and displays their quantitative responses within each group. A grouped distribution plot retains those responses; a summary plot replaces each group’s responses with a chosen summary. This follows directly from what the predictor values mean and what information the display is intended to preserve.
If category labels are stored as numbers—for example, treatment codes 1 and 2—the numbers may still be labels rather than measurements. A scatterplot axis from 1 to 2 would suggest a quantitative scale and potentially imply meaningful distances. Choose the plot based on the variable’s meaning, not its storage format.
Common Mistake and Practical Checks
A common mistake is to use a summary plot automatically whenever the predictor has categories, then describe the displayed means as though they were the entire data. For example, seeing two mean heights does not show how spread out the plant heights were within either treatment. The correction is to match the display to the question: use a grouped distribution plot when individual outcomes or within-group distributions matter, and use a summary plot when a specified group summary is the focus. If both are important, the plot should make clear which features it shows and which it leaves out.
Another mistake is to treat coded categories as quantitative just because their values are digits. Ask whether differences between predictor values have a meaningful interpretation. A measured dose of 1 mg/L versus 2 mg/L has a numerical difference; treatment codes 1 and 2 usually do not. For a categorical predictor, use category labels and a group-based display.
Before making a plot, use these checks:
- Name the observational unit and verify that each plotted response is paired with the correct predictor value or category.
- Identify whether the predictor is a measurement or a group label; do not decide from its data type in a spreadsheet alone.
- Use a scatterplot for paired quantitative variables, a grouped distribution plot to display responses within categories, or a summary plot when a group summary is the intended comparison.
- Label axes with the variable names and units, and label categories clearly.
- State whether the display shows individual outcomes or only summaries, so readers do not infer information that is not plotted.
Choosing the plot does not establish that the predictor causes changes in the response. A plot is a visual description of the recorded data. The design of the data collection and the reasoning used to interpret a relationship are separate from the choice of display.
Check Your Understanding
For each situation, identify the predictor and response types and choose a suitable starting plot.
- A researcher records daily exercise time in minutes and resting heart rate in beats per minute for each participant. Which plot is appropriate, and how should its axes be assigned?
- A hypothetical comparison records recovery time in hours for patients receiving one of three named therapies. Should the first display show individual outcomes or group summaries if the aim is to inspect variation within therapies?
- A data file stores two machine types as codes 1 and 2 and records a quantitative measurement from each machine. What should determine whether the predictor is categorical or quantitative?
- A report’s main goal is to compare the mean quantitative outcome across four categories. What type of plot could directly show that comparison, and what information would it omit?
- Why is a scatterplot generally appropriate for a quantitative predictor and response but potentially misleading when a categorical predictor is represented by numerical codes?