vec = np.array([[-3],[2]])
origin = np.zeros(vec.shape) # origin point
plt.figure(figsize=(6,6))
plt.quiver(*origin, *vec, color=['b'], scale=1, units='xy')
plt.grid()
plt.xlim(-5,5)
plt.ylim(-5,5)
plt.gca().set_aspect('equal')
plt.show()
theta = np.radians(-90)
R = np.zeros((2,2))
R[0,0] = np.cos(theta)
R[0,1] = -np.sin(theta)
R[1,0] = np.sin(theta)
R[1,1] = np.cos(theta)
print(R)
new = np.zeros(vec.shape)
new[0] = R[1,1]*vec[0] + R[0,1]*vec[1]
new[1] = R[1,0]*vec[0] + R[0,0]*vec[1]
# Numpy allows us to do vector-matrix multiplication much faster
new = R.dot(vec)
origin = np.zeros(new.shape) # origin point
plt.figure(figsize=(6,6))
plt.quiver(*origin, *new, color=['r'], scale=1, units='xy')
plt.grid()
plt.xlim(-5,5)
plt.ylim(-5,5)
plt.gca().set_aspect('equal')
plt.show()