In [1]:
import numpy as np
import matplotlib.pyplot as plt
In [2]:
M = np.array([[.5,1],
             [1,.5]])

# v = np.array([1,1])
# v = np.array([1,-1])
# v = np.array([-1,1])
v = np.random.randn(2)

Mv = M@v

plt.plot([0,v[0]],[0,v[1]],'b',linewidth=2,label='v')
plt.plot([0,Mv[0]],[0,Mv[1]],'r--',linewidth=2,label='Mv')

plt.axis('square')
plt.axis([-5,5,-5,5])
plt.grid()
plt.legend()
plt.show()

$M=\left[ \begin{matrix} .5 \quad 1 \\ 1 \quad .5 \end{matrix} \right]$

$v=\left[ \begin{matrix} 1 \\ a \end{matrix} \right]$

$a \: \epsilon \: \{ -2, ... , 2\}$

In [3]:
vcomp = np.linspace(-2,2,40)

for a in vcomp:
    v = np.array([1,a])
    Mv = M@v
    plt.plot([0,v[0]],[0,v[1]],color=[1-abs(a)/4,.5,abs(a)/2],alpha=.8)
    plt.plot([0,Mv[0]],[0,Mv[1]],color=[1-abs(a)/2,abs(a)/4,.5])
    
plt.axis('square')
plt.axis('off')
plt.show()