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(rotation=np.deg2rad(a))
p1 = tf1(p0)
t = np.linspace(np.arctan2(p0[2,1],p0[2,0]), np.arctan2(p1[2,1],p1[2,0]), 100)
r = np.linalg.norm(p0[2,:])
ax1 = plt.subplot(1, 1, 1)
plt.plot(p0[:,0], p0[:,1], 'ko-')
plt.plot(p1[:,0], p1[:,1], 'ro-.')
plt.plot(r*np.cos(t), r*np.sin(t), 'k--')
plt.plot([0, p0[1,0]], [0, p0[1,1]], 'k:')
plt.plot([0, p1[1,0]], [0, p1[1,1]], 'k:')
ax1.annotate(r'$\alpha$', xy=(float(0.5 * p0[2,0] + 0.5 * p1[2,0]) - 0.15, float(0.5 * p0[2,1] + 0.5 * p1[2,1]) - 0.15))
ax1.annotate('p', xy=(float(p0[1,0] - 0.0), float(p0[1,1] - 0.2)))

tf = transform.EuclideanTransform(translation=(2,0)) + tf1
p2 = tf(p0)
plt.plot(p2[:,0], p2[:,1], 'ro-')
ax1.annotate('', xy=(float(p2[1, 0]), float(p2[1, 1]+0.1)), xytext=(float(p1[1, 0]), float(p1[1, 1]+0.1)),
             arrowprops=dict(facecolor='black', shrink=0.1, width=0.1, headlength=5, headwidth=5), )
ax1.annotate('T', xy=(float(0.5 * p2[1, 0] + 0.5 * p1[1, 0] + 0.0), float(0.5 * p2[1, 1] + 0.5 * p1[1, 1] + 0.2)))
ax1.annotate('p*', xy=(float(p2[1, 0] - 0.0), float(p2[1, 1] - 0.2)))

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

plt.show()