with a long piece of Python code I have obtained two arrays: phi (which contains 0,1,2,...,360) and F.
If I plot F vs phi in a cartesian plot, with simply these two instructions:
plt.plot(phi,F)
plt.show()
I get the following graph.
However, if I try to plot it in a polar graph with the following piece of code:
plt.polar(phi,F)
plt.show()
I get the following graph.
The last one is not what I was expecting. I'm expecting something like a noisy circumference, since the cartesian plot of F vs phi shows a noisy behaviour with a mean value at -0.8.
I was expecting to get something similar (with different values since it refers to other variables) to this graph:
UPDATE1: As suggested by @luuk, I've converted phi
from degrees to radians. Now I get this result.
UPDATE2: After changing the rlims (set from -2 to 0.1), the picture looks like this
It's still strange since there is a filled circle inside the graph. Do you know how can I remove it (if it's simply due to too dense lines)?
UPDATE 3:
If I plot it with points ('.i'
in plot) I get a reasonable plot. But, if possible, I'd prefer to get a plot with lines.
As you can see from the Polar Demo, plt.polar()
expects the theta
argument to be in radians (with domain [0, 2π]), not in degrees. Convert phi
to radians by multiplying by np.pi/180
.