Why Points Can Hide Each Other
In a scatterplot, each observation is represented by a mark at its predictor and response values. When multiple observations have exactly the same coordinates, their marks lie on top of one another. Even when coordinates are only slightly different, large marks can overlap enough to conceal how many observations are present. The display may then make a dense location look like a single observation, or make the relationship’s pattern difficult to see.
Two common display adjustments address this problem. Transparency makes each mark partly see-through, so overlapping marks can create darker regions. Jitter adds a small, deliberate perturbation to plotted coordinates, separating marks that would otherwise coincide. Both adjustments change how marks are drawn; neither changes the recorded observations.
The goal is not to make every point look different at any cost. A useful adjustment reveals overlap while preserving the broad pattern and the scale’s meaning. If the adjustment is too strong, the display can suggest variation or relationships that are not in the recorded data.
Using Transparency to Show Dense Regions
A transparent point allows some of the background to show through. Where several marks overlap, their combined appearance is darker than that of one mark. This can reveal that a location contains more observations than nearby locations. The effect depends on the point opacity, the number of overlapping points, mark size, color, background, and rendering method. Darkness is therefore a visual cue to density, not automatically an exact count.
A simple calculation describes repeated marks with the same opacity. Assume the marks have the same color and opacity, are drawn over an opaque, uniform background, and use ordinary layered compositing. Let \(a\) be the opacity of one mark, between 0 and 1. The fraction of the background still visible after one mark is \(1-a\). After \(k\) identical marks at the same location, the background fraction is \((1-a)^k\), so the combined opacity is:
This result follows by multiplying the remaining background fraction by \(1-a\) for each additional layer. For example, after two layers the remaining fraction is \((1-a)(1-a)=(1-a)^2\). Repeating this step \(k\) times gives \((1-a)^k\); subtracting from 1 gives the fraction covered by the combined marks.
Worked Example: Calculating the Combined Opacity
A hypothetical scatterplot contains five observations at the exact same coordinates. Each point is drawn with opacity \(a=0.20\). Under the same-color, opaque-background compositing assumptions above, what is the combined opacity at that location?
Substitute \(a=0.20\) and \(k=5\) into the formula:
The five layers together cover about \(0.672\), or 67.2%, of the background at that location. One point covers 20%; the overlapping stack is substantially more opaque. This illustrates how transparency can make repeated coordinates visible as a darker patch. It does not mean that a reader can reliably infer an exact count of five from the shade: the apparent darkness can also depend on mark size, color, rendering, and whether points are at exactly the same location.
Lower opacity can help in a crowded plot, but it is not a complete solution. If marks are too small, overlapping areas may remain difficult to detect. If opacity is extremely low, isolated observations may nearly disappear. If opacity is high, a dense cluster can become an almost solid patch that hides its internal structure. The useful setting depends on the number and distribution of points and on the intended display size.
Using Jitter Without Changing the Data
Jitter is most useful when values are recorded on a limited grid, such as whole-number counts or rounded measurements, and several observations consequently share coordinates. For an observation with recorded coordinates \((x_i,y_i)\), a jittered display position can be written as:
Here \(u_i\) and \(v_i\) are small offsets used only for plotting. A common choice is to draw each independently from a uniform distribution centred at zero, with fixed bounds:
The widths \(w_x\) and \(w_y\) are expressed in the original variables’ units. This makes their size interpretable: an \(x\)-offset of 0.1 means 0.1 units of the predictor, not 10% of the plotting window. Offsets centred at zero avoid a systematic shift in one direction, but any individual displayed point still moves. For this reason, jittered positions should not be used as the recorded values for calculations or analysis.
Worked Example: Separating Repeated Coordinates With Jitter
Suppose a hypothetical data set records the number of practice sessions, \(x\), and the number of correct answers on a short quiz, \(y\). Six students all have the recorded pair \((4,7)\): four sessions and seven correct answers. With all six marks plotted at the recorded coordinates, they cover one another. For a display-only illustration, use jitter widths \(w_x=w_y=0.15\), in sessions and answers respectively. The following offset pairs are one possible set of draws; each offset lies between \(-0.15\) and \(0.15\).
| Observation | \(u_i\) | \(v_i\) | Displayed \(x_i^*=4+u_i\) | Displayed \(y_i^*=7+v_i\) |
|---|---|---|---|---|
| 1 | -0.08 | 0.03 | 3.92 | 7.03 |
| 2 | 0.04 | -0.11 | 4.04 | 6.89 |
| 3 | 0.12 | 0.06 | 4.12 | 7.06 |
| 4 | -0.03 | -0.02 | 3.97 | 6.98 |
| 5 | 0.01 | 0.14 | 4.01 | 7.14 |
| 6 | -0.13 | 0.00 | 3.87 | 7.00 |
For observation 1, for example, the plotted position is \((4-0.08,7+0.03)=(3.92,7.03)\). The display now separates the six marks enough to indicate that several observations occupy the same recorded coordinate. The non-integer plotted values do not mean that a student attended 3.92 sessions or got 7.03 answers correct. The recorded pair for every student remains \((4,7)\); only the plotted marks have moved.
The chosen width is small compared with the one-unit spacing between possible integer values. It also stays within 0.15 of the recorded values. If the plot is shown with a scale or point size that makes this adjustment visually large, the width should be reduced. The offsets should not be interpreted as measurement uncertainty or as evidence of a trend.
Choosing an Adjustment That Preserves the Pattern
Jitter widths should be chosen in the variables’ units and in relation to the spacing between recorded values. If values on an axis lie on a regular grid with nearest-neighbour spacing \(d\), then a simple sufficient condition for the jitter bands around adjacent grid values not to overlap is \(w<d/2\). Each original value can move at most \(w\), so the two adjacent values can move toward one another by at most \(2w\). When \(2w<d\), their display ranges remain separated. This is a practical guideline, not a guarantee that every jittered plot will be easy to read.
Worked Example: Selecting Jitter Widths From Grid Spacing
A hypothetical training data set has predictor values recorded in multiples of 5 milligrams and response values recorded as whole-number counts. The nearest distinct grid values are therefore 5 milligrams apart on the predictor axis and 1 count apart on the response axis. Consider predictor jitter of at most 0.8 milligrams and response jitter of at most 0.12 counts.
For the predictor, \(d=5\), so half the grid spacing is \(d/2=2.5\) milligrams. The proposed width satisfies \(0.8<2.5\). For the response, \(d=1\), so \(d/2=0.5\) counts, and \(0.12<0.5\). Thus, neither jitter range can make adjacent grid-value bands overlap under this bound.
A point recorded at \((5,3)\), with offsets \(u=-0.6\) milligrams and \(v=0.08\) counts, would be displayed at:
Those displayed coordinates are illustrative, not newly observed values. The calculation shows both that the offsets are within the proposed bounds and how the display position is formed. A different width might be preferable if the marks still overlap or if the point shifts look too large. The grid-spacing check helps prevent adjacent values from being mixed together; it does not, by itself, select the best-looking width.
There is no single width or opacity that works for every plot. Useful checks include whether the axis units make the perturbation easy to understand, whether neighbouring recorded values remain distinguishable, and whether the display still resembles the original pattern. It can also help to compare the adjusted plot with the unadjusted version, particularly when the amount of overlap is important to interpretation.
Choosing Between Transparency and Jitter
Transparency is often a sensible first choice when there are many points and the main aim is to show where points accumulate. It leaves each point centred at its recorded coordinates, although the darkness of overlapping marks is approximate evidence of density rather than a direct count. Jitter can be useful when many observations fall on a small number of exact grid locations and the individual repeated positions need to be made visible.
The two adjustments may be used together, but combining them does not remove the need for care. Jitter spreads marks away from their recorded coordinates; transparency helps overlapping marks show through one another. If jitter is too wide, the marks can obscure a genuine pattern. If opacity is too low, individual marks can vanish into the background. For genuinely continuous measurements with few exact repeats, jitter is usually unnecessary: it may suggest that the recorded coordinates are less precise than they are.
Use the original recorded coordinates whenever a question concerns the data themselves. If a point’s exact value matters, read it from the data or an unjittered display, not from a displaced mark. If the display settings use random offsets, using a fixed random seed can make the same jittered arrangement appear again when the plot is regenerated. That improves reproducibility of the picture; it does not make the jittered positions observed values.
Common Mistake: Treating Display Positions as Measurements
A common mistake is to look at a jittered point at \((4.12,7.06)\) and report that the recorded values were 4.12 and 7.06. That reasoning confuses the location of a drawn mark with the observation that it represents. The correction is to retain the original values and regard the offsets as a way of seeing how many marks overlap. Jitter may reveal repeated values, but it cannot supply extra precision or change what was measured.
A related mistake is to interpret a darker patch in a transparent scatterplot as an exact count. The correction is to describe it cautiously as a region where marks appear more concentrated, unless the plot uses a separate, explicit method for reporting counts. Mark size, opacity, and rendering affect the shade, so equal counts do not always look equally dark across different settings or plots.
Check Your Understanding
Try these questions without looking back.
- In your own words, explain why several observations at identical coordinates may look like a single point in an ordinary scatterplot.
- Four identical marks each have opacity \(a=0.25\). Using \(1-(1-a)^k\), calculate their combined opacity under the stated compositing assumptions.
- A response is recorded as a whole-number count. A jittered mark appears at 6.12. What can you conclude about the recorded response, and what can you not conclude from that plotted coordinate alone?
- Recorded predictor values are spaced 4 units apart. Does a jitter width of 1.1 units satisfy the simple condition \(w<d/2\) for keeping adjacent jitter bands separate? Show the comparison.
- Give one reason transparency can help show dense regions and one reason that apparent darkness should not automatically be read as an exact count.