Proximity Matrix Calculator

Enter your objects and their values to get a full distance matrix with heatmap colouring, and switch measures to see how the answer changes.

Proximity matrix
Distance measure
Matrix

What this tool does

A proximity matrix is a square table giving the distance or similarity between every pair of objects in a data set. It is the input step for hierarchical clustering and multidimensional scaling. Which measure you choose changes the answer, so the choice is part of the analysis rather than a detail.

Computes the full pairwise matrix for your objects using Euclidean distance, Manhattan distance or cosine similarity, and colours the cells so clusters are visible in the table itself.

All three measures sit side by side so you can switch between them on the same data and see how much the choice matters, which is difficult to do in a spreadsheet.

How to use it

  1. Enter one object per line as a label followed by its values, separated by commas.
  2. Give every object the same number of values - the tool warns you if they differ.
  3. Turn on standardise if your columns are in different units - a column measured in hundreds of thousands otherwise decides the answer on its own.
  4. Switch between Euclidean, Manhattan and cosine to compare.
  5. Read the summary beneath the heatmap for the most alike and least alike pair, worked out the right way round for the measure you chose.
  6. Copy or download the matrix as CSV, or export the heatmap as SVG or PNG.

Why use this chart maker

Clustering and similarity analysis start from a distance matrix, and computing it by hand grows quickly with the number of objects. Choosing a measure and seeing a heatmap shows the structure.

Why we built it

We built the proximity matrix calculator to show Euclidean, Manhattan and Chebyshev distances side by side with heatmap colouring. Plot the same objects on the scatter plot maker or the heatmap generator.

Who this tool is for

  • Statistics and data-science students
  • Researchers comparing objects
  • Teachers explaining distance measures

When to use it

  • Statistics and data-mining coursework.
  • Checking distances before clustering.
  • Comparing objects by several features.
  • Choosing between Euclidean, Manhattan and cosine.

The three measures, and why the choice matters

Euclidean distance

Straight-line distance through the space - the square root of the summed squared differences. It is the default for good reason and matches physical intuition, but squaring the differences means one large gap on a single dimension dominates the result.

Manhattan distance

The sum of the absolute differences, as though you could only travel along the grid. Because differences are not squared, it is less swayed by a single outlying dimension. It is often the better choice for high-dimensional data, where Euclidean distances tend to converge on each other.

Cosine similarity

The angle between two vectors rather than the gap between their endpoints. It ignores magnitude entirely, so two objects with the same profile at different scales count as identical. That is exactly what you want for text and for any data where overall size is not the interesting part.

Cosine is a similarity, not a distance. 1.000 means identical direction and 0 means unrelated - the opposite convention to Euclidean and Manhattan, where 0 means identical. The heatmap here inverts its colour ramp to match, but reading a cosine matrix as though low numbers mean close is a genuine and common error.

Scaling, and why it usually decides the outcome

Distance measures have no notion of units. If one variable is measured in thousands and another in fractions, the first will dominate every distance almost entirely, and the matrix will describe that one variable rather than the objects.

Standardise your variables before computing distances unless you have a reason not to - typically by converting each to a z-score, so every variable contributes comparably. This tool computes distances on the numbers you give it and does not rescale them for you, because silently transforming input is worse than leaving the decision visible.

Choosing a measure
MeasureRangeIdentical objects giveSuits
Euclidean0 upward0Low-dimensional continuous data on a common scale
Manhattan0 upward0High-dimensional data, or data with outliers
Cosine-1 to 11Text, profiles, and data where magnitude is irrelevant

Reading the matrix

The matrix is symmetric - the distance from A to B equals the distance from B to A - so the two triangles mirror each other. The diagonal compares each object with itself and is therefore always 0 for a distance measure and 1 for cosine.

Blocks of similar colour away from the diagonal are what clustering algorithms latch onto: a group of objects all close to each other and all far from the rest. Reordering the rows so those blocks sit together along the diagonal is essentially what hierarchical clustering does.

What you give it, and what you get back

Input and output of Proximity Matrix Calculator
ItemDetails
InputObject names with numeric values for each variable.
MeasureEuclidean, Manhattan or cosine similarity.
OutputA full matrix with heatmap colouring.

Issues you may run into

Common problems with Proximity Matrix Calculator
What you seeWhy it happensWhat to do
One variable dominatesValues are on different scales.Standardise to z-scores first.
Categorical data failsOnly numbers are supported.Use a measure suited to categories.
A row is skippedIt does not match the expected format.Check the message listing unreadable lines and fix them.

Assumptions and limitations

Frequently asked questions

What is a proximity matrix?

A square table giving the distance or similarity between every pair of objects in a data set. It is symmetric, since A to B equals B to A, and it is the standard input to hierarchical clustering and multidimensional scaling.

What is the difference between Euclidean and Manhattan distance?

Euclidean is straight-line distance, computed from squared differences, so one large gap on a single dimension has outsized influence. Manhattan sums the absolute differences instead, which makes it more robust to outliers and often better behaved in high dimensions.

What is a distance matrix used for?

Mainly as the input to hierarchical clustering, which repeatedly merges the closest pair. It also drives multidimensional scaling, nearest-neighbour searches, and any analysis that needs to know which items resemble which.

When should you use cosine similarity?

When the direction of the data matters but its magnitude does not - text documents of different lengths, user preference profiles, or any data where a long document and a short one on the same subject should count as similar. Remember it returns similarity, so 1 means identical.

How do you read a proximity matrix heatmap?

Compare cells against the diagonal, which is the self-comparison baseline. For distance measures, darker means further apart; for cosine, darker means more similar. Blocks of similar colour off the diagonal indicate clusters.