0

I have a large data set with files containing three also large single column vectors (backazimuth, frequency and power) for every day in a month. I would like to display the data on a polar plot using something like contourf. However, I am not sure how to reshape the power data into a 2D array. An example is below,

from pylab import *

x=rand(100)
y=rand(100)
z = rand(100)    # 1D

BAZ, FREQ = meshgrid(x, y)
ax = plt.subplot(111, polar=True)
contourf(BAZ, FREQ, z)       # z needs to be 2D

Any know how I can reshape z so this will work??? thanks, David

Dave
  • 1,170
  • 3
  • 20
  • 30
  • Have a look at [this](http://stackoverflow.com/questions/6548556/polar-contour-plot-in-matplotlib) question (possible duplicate). – tiago Nov 19 '12 at 12:20

1 Answers1

0

From link in tiago's comment above answer is,

x=rand(100)
y=rand(100)
z = rand(100) 

xgrid = np.linspace(x.min(), x.max(), 100)
ygrid = np.linspace(y.min(), y.max(), 100)
xgrid, ygrid = np.meshgrid(xgrid, ygrid)
zgrid = griddata((x,y),z, (xgrid, ygrid))

ax = plt.subplot(111, polar=True)
contourf(xgrid, ygrid, zgrid)   

Thanks,
D.

Community
  • 1
  • 1
Dave
  • 1,170
  • 3
  • 20
  • 30