Here is the code snippet:
fig, ax = plt.subplots(figsize=(30, 20))
ax.axis('equal')
ax.set(xlim=(-10, 10), ylim=(-10, 10))
circle = plt.Circle((0, 0), 3.1, fc='cyan')
ax.add_patch(circle)
def kex(N):
alpha=2*np.pi/N
alphas = alpha*np.arange(N)
coordX = np.cos(alphas)
coordY = np.sin(alphas)
return np.c_[coordX, coordY, alphas]
data = 'P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14'.split(' ')
radius = 3.3
points = kex(len(data))
for i in range(0, len(data)):
a = points[i,2]
x,y = (radius*np.sin(a), radius*np.cos(a))
a = a - 0.5*np.pi
if points[i, 1] < 0:
a = a - np.pi
ax.text(x, y, data[i], rotation=np.rad2deg(a), ha="center", va="center", fontsize=15)
ax.axis("off")
plt.show()
I want to place the text around a circle but does not seem to find correct rotation values. Some code is taken from here I have tweaked some bits in the code but does not seem to find the correct rotation values. Can someone help?
Edit 01:
I want something like this screenshot taken from here.