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

1
  • Have a look at this question (possible duplicate). Commented Nov 19, 2012 at 12:20

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.