import matplotlib.pyplot as plt
import numpy as np
from skimage import transform
p0 = np.array([[0, 1],[0, 0],[1,0]])
a = 30
tf1 = transform.EuclideanTransform(translation=(2,0))
p1 = tf1(p0)
ax1 = plt.subplot(1, 1, 1)
plt.plot(p0[:,0], p0[:,1], 'ko-')
plt.plot(p1[:,0], p1[:,1], 'ro-.')
ax1.annotate('', xy=(float(p1[1, 0]), float(p1[1, 1]-0.2)), xytext=(float(p0[1, 0]), float(p0[1, 1]-0.2)),
             arrowprops=dict(facecolor='black', shrink=0.1, width=0.1, headlength=5, headwidth=5), )
ax1.annotate('T', xy=(float(0.5 * p0[1, 0] + 0.5 * p1[1, 0]) + 0.0, float(0.5 * p0[1, 1] + 0.5 * p1[1, 1] - 0.4)))
ax1.annotate('p', xy=(float(p0[1, 0] - 0.15), float(p0[1, 1] - 0.15)))

tf2 = transform.EuclideanTransform(rotation=np.deg2rad(a))
p2 = tf2(p1)
t = np.linspace(np.arctan2(p1[1,1],p1[1,0]), np.arctan2(p2[1,1],p2[1,0]), 100)
r = np.linalg.norm(p1[1,:])
plt.plot(p2[:,0], p2[:,1], 'ro-')
plt.plot(r*np.cos(t), r*np.sin(t), 'k--')
plt.plot([0, p1[1,0]], [0, p1[1,1]], 'k:')
plt.plot([0, p2[1,0]], [0, p2[1,1]], 'k:')
ax1.annotate(r'$\alpha$', xy=(float(0.5 * p2[1,0] + 0.5 * p1[1,0]) - 0.15, float(0.5 * p2[1,1] + 0.5 * p1[1,1]) - 0.15))
ax1.annotate('p*', xy=(float(p2[1, 0] + 0.0), float(p2[1, 1] + 0.15)))

plt.axis((-1, 4, -1, 3))
ax1.set_aspect('equal')

plt.show()