.. _sphx_glr_auto_examples_plot_procrustes.py: ============================= Aligning two matrices with the procrustes function ============================= In this example, we load in some synthetic data, rotate it, and then use the procustes function to get the datasets back in alignment. The procrustes function uses linear transformations to project a source matrix into the space of a target matrix. .. rst-class:: sphx-glr-horizontal * .. image:: /auto_examples/images/sphx_glr_plot_procrustes_001.png :scale: 47 * .. image:: /auto_examples/images/sphx_glr_plot_procrustes_002.png :scale: 47 .. code-block:: python # Code source: Andrew Heusser # License: MIT # import import hypertools as hyp import numpy as np import scipy # load example data geo = hyp.load('spiral') geo.plot(title='Before Alignment') # use procrusted to align the data source, target = geo.get_data() aligned = [hyp.tools.procrustes(source, target), target] # after alignment hyp.plot(aligned, ['-','--'], title='After alignment') **Total running time of the script:** ( 0 minutes 0.222 seconds) .. only :: html .. container:: sphx-glr-footer .. container:: sphx-glr-download :download:`Download Python source code: plot_procrustes.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_procrustes.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_