0
votes

I have a 64x360 Matrix of values belonging to radial and azimuthal coordinates. I want to visualize them in two plots: a cartesian and a polar plot. I visualized the heatmap in cartesian coordinates using imshow():

import numpy as np
import matplotlib.pyplot as plt

P=np.loadtxt('Pdata.csv')
print np.shape(P)
plt.imshow(P)
plt.xlabel('radius')
plt.ylabel('theta')
plt.show()

This gives me the desired plot: enter image description here

The same plot in polar coordinates was also pretty straigh forward using pcolor():

r=np.arange(0,np.shape(P)[1],1)
t=np.arange(0,np.shape(P)[0],1)

R,T  = np.meshgrid(r,t)

fig = plt.figure()
ax = fig.add_subplot(111, polar = True)
ax.pcolor(T,R,P)   
plt.show()

However, I am not really satisfied with the result: enter image description here

The resolution of the plot seems to be pretty limited so that it's not possible to distinguish between angles with higher intensity and lower intensity, as it is in the cartesian plot. The whole solid angle seems to be divided into six or seven "cake wedges" only. Is there an easy and pythonic way to enhance the angular resolution?

1
Can you provide some example data? If it's quite long, stick it in a pastebin.Ffisegydd
the whole file is too large. I've put about half of it into a pastebin: pastebin.com/P0FU72Xz shape=360x26MartyMcFly

1 Answers

0
votes

Ok, I found out something. It works with:

t = np.radians(np.linspace(0, np.shape(P)[0],np.shape(P)[0]))
r = np.arange(0, np.shape(P)[1], 1)

Just as seen here: Polar contour plot in matplotlib - best (modern) way to do it?