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.0), float(p0[1, 1] - 0.2)))

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

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

plt.show()