0

I am transforming some data from cartesian to polar values, I would like to know:

  1. how to annotate the values of the angles to the polar plot, I could plot the values but when annotating, all the values are not in their respective points.

  2. how to generate the real values since the angles from negatives axes don't present the real angle, should apply this for each quadrant? I Use the calculator value II Add 180° to the calculator value III Add 180° to the calculator value IV Add 360° to the calculator value

here is my code: `

for i in coorvalues:
    rho = np.sqrt(a**2 + b**2)
    phi = np.arctan2(a, b)

polarcoor= (rho,phi, capacity)
polarvalues= list(zip(rho,phi,capacity))
print('they are the raw polar values(r,theta,capacity): ', polarvalues)

#plot the polar coordinates
ax = plt.axes(polar=True)
plt.scatter(phi[0:],rho[0:], c="g", s=30)
for i in range(len(rho)):
    ax.annotate(phi, xy=(phi[0], rho[0]))
plt.show()

`

and here is the image of the results:

enter image description here

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Kathya
  • 11
  • 2
  • Please see [mcve] as your example not only lacks the necessary imports, but also some variable definitions to run – SpghttCd Nov 27 '19 at 20:14

1 Answers1

0

You do some mistakes in loops all over your code: If you don't use the iterating variable within a loop, you'll just do the same thing n times... However, perhaps you find this helpful:

#plot the polar coordinates
ax = plt.axes(polar=True)
plt.scatter(phi, rho, c="g", s=30)
for p, r in zip(phi, rho):
    ax.annotate(np.rad2deg(p), xy=(p, r))
plt.show()
SpghttCd
  • 10,510
  • 2
  • 20
  • 25
  • I plotted it, but I got negative values in some of the quadrants, is there any further step to avoid this?, or how can I get the degree values ? – Kathya Nov 28 '19 at 09:25
  • This code worked with data I created to test it. We cannot help you in detail if you won't provide a proper [mcve]. – SpghttCd Nov 28 '19 at 12:25