What Does Density in an Embedding Mean?
A crowded patch in a t-SNE or UMAP plot is easy to read as a region with many cells, a biologically abundant population, or a tightly defined cell state. Those interpretations are not equivalent. A plot shows the positions assigned by a dimension-reduction method; the amount of area those positions occupy is not generally constrained to reflect how densely cells were distributed in the original expression space.
For a simple plot-based summary, define the apparent embedding density of a group as its number of plotted cells divided by the area they occupy. This value depends on how the area is defined—for example, a bounding region, a contour, or a local neighborhood estimate—and on the plotted coordinates. It is not the same thing as the number of cells in the group, nor is it automatically an estimate of density in the original high-dimensional space.
Even the units signal a limitation: embedding units are not a biological measurement scale. Rescaling the same plotted coordinates changes apparent density, while leaving all cell identities and the original data unchanged. More fundamentally, both t-SNE and UMAP are designed to represent selected aspects of neighborhood structure, not to make the area occupied by a group a faithful measure of its original density.
Why t-SNE Can Alter Apparent Concentration
In t-SNE, each cell \(i\) assigns conditional probabilities to its neighbors. In a common formulation, those probabilities depend on squared distances \(d_{ij}^2\) and a cell-specific bandwidth \(\sigma_i\):
The bandwidths are adjusted to target a specified perplexity, an effective neighborhood size. As a result, different cells can have different bandwidths: in a locally sparse part of the data, a cell may need a broader bandwidth to assign probability across a neighborhood of the target size; in a locally dense part, a narrower bandwidth may suffice. These adaptive scales help explain why the resulting map is not a literal drawing of the input-space density.
The high-dimensional conditional probabilities are combined into symmetric similarities \(p_{ij}\). In the low-dimensional map, t-SNE defines similarities \(q_{ij}\) using a heavy-tailed Student \(t\) kernel and chooses coordinates to reduce the discrepancy between the two similarity distributions. In the standard objective, that discrepancy is the Kullback–Leibler divergence:
This objective gives strong emphasis to pairs with substantial high-dimensional similarity. It does not include a requirement that a group’s plotted area be proportional to its original-space density. The heavy-tailed low-dimensional similarities help accommodate cells that are not close neighbors, but they do not turn the map into a density-preserving transformation. Perplexity and other optimization choices can change the arrangement and compactness of neighborhoods, so apparent density may change as well.
Why UMAP Can Alter Apparent Concentration
UMAP also starts from local relationships rather than from a requirement to preserve density. Its construction assigns strengths to neighbor relationships using local distance scales. A common directed membership form is \(w_{ij}=\exp[-\max(0,d_{ij}-\rho_i)/\sigma_i]\), where \(\rho_i\) sets a local distance offset and \(\sigma_i\) is a locally adjusted scale. The directed memberships are combined to make a fuzzy graph whose edges represent the strength of neighborhood relationships.
UMAP then places points in a low-dimensional space so that low-dimensional relationships agree, in aggregate, with this graph. Its cross-entropy objective rewards retaining graph edges and penalizes certain non-edge relationships. The objective is not a constraint that the area occupied by each group must reproduce its original-space density. The graph retains selected neighborhood information; it does not encode a unique, density-preserving map of the full data.
Parameters affect the display in different ways. The number of neighbors, often called n_neighbors, influences the neighborhood scale represented by the graph. The min_dist setting influences how close points are allowed or encouraged to be in the embedding through the low-dimensional relationship curve. A smaller min_dist can produce more compact-looking neighborhoods, but that is not evidence that the corresponding cells were more concentrated in the input data. These settings influence the geometry of the representation, not the biological number of cells.
A Basic Reason Area-Based Density Is Not Invariant
A simple rescaling demonstrates why raw embedding density cannot be an intrinsic property of the cells. Suppose every two-dimensional coordinate \(y_i\) is multiplied by a positive constant \(c\). Distances are then multiplied by \(c\), and areas by \(c^2\), while the count \(N\) remains the same. Thus:
For example, doubling both coordinate axes quadruples the area and reduces cells per squared embedding unit to one quarter. The input profiles have not changed. This is a complete reason that area-based density depends on representation. More generally, a nonlinear mapping can expand some neighborhoods and contract others by different amounts, so there is no single scale correction that will recover original-space density everywhere.
Worked Example: Equal Cell Counts, Different Apparent Densities
Suppose two labeled groups each contain 100 cells. In one hypothetical embedding, group A occupies an outlined region of 10 squared embedding units, while group B occupies 40 squared embedding units. Using those stipulated regions, calculate their simple apparent densities.
For group A: \(100\text{ cells}/10\text{ squared embedding units}=10\) cells per squared embedding unit.
For group B: \(100\text{ cells}/40\text{ squared embedding units}=2.5\) cells per squared embedding unit.
The displayed density for A is four times that for B, because \(10/2.5=4\). Yet both groups have the same cell count. This calculation describes the chosen regions in this hypothetical plot. It does not establish that group A was four times as abundant, or four times as dense in the original expression space. The result also depends on how the occupied areas were outlined.
Worked Example: Unequal Counts, the Same Apparent Density
Consider a second hypothetical embedding. Group C has 200 cells in a region of 20 squared embedding units; group D has 50 cells in a region of 5 squared embedding units. Calculate both apparent densities.
For group C: \(200/20=10\) cells per squared embedding unit.
For group D: \(50/5=10\) cells per squared embedding unit.
The displayed densities are equal under these area definitions, although C has four times as many plotted cells as D: \(200/50=4\). Equal apparent density therefore does not imply equal cell counts. Conversely, the unequal counts do not establish that the underlying biological populations differ in prevalence, since the observed counts can also depend on sampling and cell recovery.
Worked Example: A Parameter Change Alters the Visual Summary
Suppose the same 120 cells are embedded in two hypothetical UMAP runs with the same input profiles, but different min_dist settings. In run 1, a specified contour around the cells has area 24 squared embedding units. In run 2, the contour has area 12 squared embedding units. Compute the apparent density in each run.
Run 1: \(120/24=5\) cells per squared embedding unit. Run 2: \(120/12=10\) cells per squared embedding unit.
Under these stipulated contours, the second run has twice the apparent density. The count has not changed; the plotted area has halved. A smaller min_dist can be associated with more compact-looking layouts, but these numbers are hypothetical summaries, not a quantitative law relating min_dist to occupied area. The justified conclusion is that the plot-based density changed with the representation, not that the cells became biologically more concentrated.
How to Evaluate a Density Impression
When apparent density matters to an interpretation, separate three questions: how many cells are present, how much plotted area they occupy, and how concentrated the cells were in the original representation. Report or inspect these quantities separately rather than using one as a substitute for the others.
Give the number of cells in each group and clarify whether the comparison concerns observed cells, sampled cells, or a population-level abundance claim.
Specify how regions or local density estimates are constructed. A convex outline, a contour, and a fixed-radius neighborhood need not give the same answer.
Compare reasonable settings or methods and note whether the visual density impression persists. Keep the input data and preprocessing fixed when isolating embedding choices.
If the scientific question concerns local concentration in expression space, examine neighborhood distances or density summaries there, with a stated metric and scale, rather than treating two-dimensional area as a direct proxy.
Diagnostics include a large density change after changing perplexity or min_dist, apparent compactness that depends on plotting limits or contours, and conclusions based only on how dark a region looks. Overplotting can make a region appear dense even when point counts per unit area are not comparable; transparency, point size, and unequal numbers of cells can all affect visual impression. A density estimate also depends on its smoothing bandwidth or neighborhood scale, so comparisons require a consistent definition.
What Alternatives Can and Cannot Tell You
| Approach | What it can support | Important limitation |
|---|---|---|
| Count cells by labeled group | Compares the number of observed cells in each group. | Does not adjust for sampling, cell recovery, or other design features that affect observed counts. |
| Estimate local density in the original representation | Addresses concentration at a stated scale and under a stated distance metric. | Results depend on the metric, neighborhood scale, and data representation. |
| Compare apparent density in an embedding | Describes how cells are distributed in that particular display under a specified area rule. | Does not establish original-space density or biological abundance. |
| Use a linear projection such as PCA | Provides a projection whose coordinates are explicit linear combinations of the input features. | A projection can discard dimensions and distort distances or density; it is not automatically density preserving. |
These approaches answer different questions. A count comparison concerns observed numbers. An original-space neighborhood analysis concerns local structure under a chosen metric and scale. An embedding-density calculation concerns the displayed coordinates. No one summary should be silently substituted for another.
Common Mistakes and Limitations
- Reading crowdedness as abundance. A compact patch can have a high cells-per-area value while containing fewer cells than a broader patch. Count the cells separately.
- Reading crowdedness as original-space density. t-SNE and UMAP do not impose area preservation. Use an original-space analysis for a claim about original-space concentration.
- Comparing plots with different scales as though units matched. Coordinate scaling changes area and therefore changes cells per squared embedding unit. Define a common display scale or avoid treating that value as comparable.
- Assuming a parameter setting has a fixed biological interpretation. Perplexity, n_neighbors, and min_dist influence aspects of the representation; none is a direct measure of cell abundance.
- Equating observed cell counts with population prevalence. Experimental sampling and cell recovery can affect the observed numbers. A plot alone cannot resolve those design issues.
The central limitation is not that embedding density is impossible to describe. It is that the description must remain tied to its construction: which cells, which coordinates, what area rule, and what settings. Once those are explicit, it is a valid summary of a plot, but not automatically a biological conclusion.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- Two regions each contain 80 cells. Their areas are 8 and 16 squared embedding units. What are their apparent densities, and what can you conclude about their counts?
- A group has 150 cells in an area of 30 squared embedding units in one plot. All coordinates are then doubled. What is the new area and apparent density?
- Why can a smaller UMAP min_dist make a group look more concentrated without showing that its original-space density increased?
- What is the difference between comparing observed group counts and comparing cells per embedding area?
- Name two choices that must be stated or held consistent to make an embedding-density comparison interpretable.
Solutions. (1) The densities are \(80/8=10\) and \(80/16=5\) cells per squared embedding unit. The counts are equal at 80; the apparent densities differ because the areas differ. (2) Doubling coordinates multiplies area by \(2^2=4\), so the new area is \(30(4)=120\) squared embedding units and the density is \(150/120=1.25\) cells per squared embedding unit. (3) min_dist affects the low-dimensional layout and can change occupied area; the embedding objective does not require that area to preserve original-space density. (4) Counts compare numbers of observed cells, whereas cells per embedding area also depends on the area assigned to their displayed coordinates. (5) Suitable answers include the area or density-estimation rule, coordinate scale, embedding method and parameter settings, and the input data and preprocessing.