An example of Multidimensional Scaling (almost completely taken from this article by Ben Frederickson).
A matrix of distances between cities is fed into a simple javascript function (again, by Ben Frederickson) that uses numeric.js to compute the cities’ position. Rotation and mirroring (manually adjusted in this example) are free.
Click on a city to see an indication of the distance errors.