t-SNE and UMAP for visualisation plot analysis

Distances in the Plot Do Not Mean What You Think

I remember sitting in a windowless lab three years ago, staring at a scatter plot that looked more like a Jackson Pollock painting than a meaningful dataset. I had spent forty-eight hours tuning hyperparameters, only to realize I was looking at a hallucination of my own making. This is the trap everyone falls into when they start using t-SNE and UMAP for visualisation; we treat these algorithms like magic black boxes that transform chaos into clarity, when in reality, they are more like unreliable narrators. They don’t just show you your data; they actively rearrange it according to their own mathematical biases, often creating clusters where none exist or hiding the very connections you were looking for in the first place.

I’m not here to give you a tutorial on how to call a library in Python, nor am I going to sell you on the idea that one is objectively “better” than the other. Instead, I want to pull back the curtain on the actual mechanics—the way they handle distance, the way they treat local versus global structure, and exactly where they tend to break. My goal is to help you understand the trade-offs so that when you finally do hit ‘plot’, you actually know what you’re looking at.

Table of Contents

t-SNE: The Local Specialist

t-SNE: The Local Specialist dimensionality reduction map.

t-SNE, or t-distributed Stochastic Neighbor Embedding, is a non-linear dimensionality reduction technique designed to transform complex, high-dimensional datasets into a two or three-dimensional map. It works by converting Euclidean distances between points into conditional probabilities that represent similarities, then minimizing the divergence between these probabilities in the low-dimensional space. Its primary strength lies in its ability to preserve local structure, effectively ensuring that points that are close together in the original high-dimensional space remain neighbors in your visualization.

When I’m digging through a messy dataset of single-cell RNA sequences or high-dimensional embeddings, t-SNE is often my first stop because it is incredibly good at revealing distinct clusters. It takes a chaotic cloud of data and pulls it apart into islands that are visually intuitive. However, I always remind my junior engineers that these islands are somewhat deceptive; because t-SNE prioritizes local neighbors, the actual distance between two far-away clusters doesn’t tell you much about how related they truly are. It shows you the neighborhoods, but it doesn’t necessarily show you the geography of the whole continent.

UMAP: The Global Architect

UMAP: The Global Architect of data visualization.

UMAP, or Uniform Manifold Approximation and Projection, is a manifold learning technique based on Riemannian geometry and algebraic topology that seeks to project high-dimensional data into a lower-dimensional representation. The mechanism relies on constructing a fuzzy topological structure of the data and then optimizing a low-dimensional layout to match that structure as closely as possible. While it shares some DNA with other neighbor-based methods, its main selling point is its ability to balance local and global structure much more effectively than its predecessors.

In my research, I find UMAP to be the more robust tool when the relative positioning of clusters actually matters for the hypothesis I’m testing. If I need to see not just that Group A and Group B are different, but that Group A is fundamentally more similar to Group B than it is to Group C, UMAP is the tool for the job. It feels less like it is just shattering the data into pieces and more like it is trying to create a faithful, scaled-down map of the underlying manifold. It’s faster, too, which is a massive relief when you aren’t waiting hours for a plot to render.

Comparison of Dimensionality Reduction Techniques for Visualization

Feature t-SNE UMAP
Mathematical Basis Probabilistic/Local Similarity Topological/Graph-based Structure
Global Structure Preservation Poor High
Local Structure Preservation Excellent High
Computational Speed Slow Fast
Scalability to Large Datasets Low High
Determinism Stochastic (changes per run) Stochastic (but more stable)
Best For Fine-grained local cluster identification Large-scale datasets and global topology preservation

The Tension Between Preserving Local vs Global Structure

When you project high-dimensional data onto a 2D plane, you are essentially performing a violent compression. You cannot keep everything. The fundamental tension in dimensionality reduction is deciding which information to save and which to discard: do you care about the neighborhoods (the small clusters of similar points) or the map (how those clusters relate to one another across the entire space)? If you get this wrong, your visualization isn’t just misleading; it’s a hallucination.

t-SNE is almost obsessively focused on the local. It uses a probability distribution that decays rapidly, meaning it cares deeply about ensuring that a point’s immediate neighbors stay its neighbors in the projection. The cost, however, is that the inter-cluster distances become largely meaningless. You might see three distinct islands on your screen, but you cannot assume those islands are actually far apart in the original high-dimensional space; t-SNE simply doesn’t prioritize that relationship.

UMAP takes a different mathematical approach, rooted in Riemannian geometry, which allows it to maintain a better sense of the global manifold. While it is still excellent at capturing local clusters, it attempts to preserve the broader topological structure. This means that if Cluster A is closer to Cluster B than to Cluster C in your high-dimensional data, UMAP is significantly more likely to reflect that relative positioning in your plot.

For this specific tug-of-war, UMAP wins because it provides a more honest representation of the data’s overall landscape.

Why Non Linear Dimensionality Reduction Distorts Your Reality

When we use these tools, we aren’t just “viewing” data; we are performing a violent act of compression. You are taking a high-dimensional manifold—a shape existing in hundreds or thousands of directions—and trying to squash it onto a flat piece of glass. The danger isn’t just that the picture looks pretty; it’s that the geometry you see is often a lie created by the algorithm’s own mathematical assumptions.

t-SNE is particularly prone to this because it treats the world as a series of local neighborhoods. It cares deeply about who your immediate neighbors are, but it is almost entirely indifferent to the distance between distant clusters. If you see two blobs on a t-SNE plot, you cannot assume they are actually far apart in the original space; the algorithm might have just pushed them away because it ran out of room to organize the local connections.

UMAP attempts to mitigate this by using a more rigorous topological foundation, which theoretically allows it to maintain a better sense of the “big picture.” However, don’t let that fool you into thinking it is a perfect mirror. UMAP still relies on a construction of a fuzzy simplicial complex that can hallucinate connections where none exist, especially if your hyperparameter settings are aggressive.

For this specific problem of distortion, UMAP is the winner, simply because its mathematical framework gives you a more reliable (though still imperfect) sense of global distance.

The Reality Check: What to Carry Away From This

Don’t treat your visualization as a ground truth map; whether you use t-SNE or UMAP, you are looking at a distorted projection where the distances between clusters are often more a product of the algorithm’s math than the actual underlying data.

Choose your tool based on your specific investigative goal: use t-SNE if you need to find the fine-grained, local “neighborhoods” within your data, but lean toward UMAP if you need to maintain a sense of how those neighborhoods relate to one another across the broader landscape.

Always run your intuition through a stress test by checking how sensitive your clusters are to hyperparameter tweaks—if a small change in perplexity or n_neighbors completely rearranges your plot, you aren’t looking at a signal; you’re looking at an artifact.

Choosing Your Lens

At the end of the day, choosing between t-SNE and UMAP isn’t about finding a “better” algorithm; it is about deciding which kind of distortion you are willing to tolerate. If your priority is finding those tight, granular clusters and you don’t mind if the distance between those clusters becomes mathematically meaningless, t-SNE is your tool. But if you need to maintain a sense of how different groups relate to one another across the entire manifold, UMAP is almost certainly the more robust choice. Just remember that neither of these methods is a magic mirror. They are both mathematical projections that inevitably trade some truth for the sake of visibility, and you must never mistake a visual cluster for a physical law.

I often think about my mechanical calculators when I look at these embeddings. A gear doesn’t care about the “meaning” of the number it’s turning; it only cares about the mechanical constraints of its teeth and its neighbors. Dimensionality reduction is similar. These algorithms are just gears turning to force a high-dimensional reality into a low-dimensional shape. Instead of looking for a single “correct” visualization, I encourage you to run both. See where they disagree. The tension between their results is often where the most interesting features of your data are actually hiding.

About Dr. Ingrid Falk-Weller

I write for the person who wants to understand the mechanism, not memorise the conclusion. If a claim has a caveat, the caveat goes in the paragraph, not a footnote.