Note
Go to the end to download the full example code.
Aligning two matrices with Procrustes¶
run this example as a notebook — or grab the .ipynb (also linked at the bottom of the page)
The spiral dataset holds two copies of the same 3-D spiral, one of
them rotated. Procrustes alignment finds the linear transformation
(rotation, reflection, and scaling) that projects a source matrix onto a
target matrix, so the two spirals land on top of each other. The first
figure shows the two spirals as loaded; the second aligns them with
model='Procrustes' through hyp.align, and the third does the same
thing inside a single hyp.plot call via its align kwarg.

hyp.align with the Procrustes model projects every dataset onto the
first one (the alignment target; pass index= to choose another).

The same alignment can run inside hyp.plot with the align kwarg; the
dictionary form passes the model’s keyword arguments (here, aligning onto
the second spiral instead of the first).
hyp.plot(data, ['-', '--'],
align={'model': 'Procrustes', 'kwargs': {'index': 1}},
title='After alignment (align= in hyp.plot)')

Total running time of the script: (0 minutes 0.066 seconds)