2017-04-21 6 views
1

matplotlib의 극좌표를 플로팅하려고합니다. 내가 정상, 직교 좌표를 사용할 때, 나는 음모 내가 원하는 얻을 :Python의 극좌표 - 만화경처럼 최고점을 반복합니다.

dir_mesh, f_mesh = np.meshgrid(dir,freq[indsf]) 

pl.pcolor(dir_mesh,f_mesh,S1) 

정확한 플롯 내가 극성 프로젝션을 사용하는 경우

는, 다수의 피크가 존재!

ax = pl.subplot(111,projection = "polar") 
ax.set_theta_zero_location("N") 
ax.set_theta_direction(-1) 
c = ax.pcolor(dir_mesh,f_mesh,S1) 

만화경 극성 플롯 (잘못된) 극성 플롯의

답변

0

단위는 방사 점 (radiants)이다. 당신은 0에서 360까지,도 단위로 데이터를 제공하는 경우, 데이터가 극성 플롯 주위에 57 번 회전하고 그 결과는 다음과 같을 것이다 다음을 얻기 위해

import matplotlib.pyplot as plt 
import numpy as np 

theta = np.arange(0,361,10) 
r = np.linspace(0.,0.8,len(theta)) 
ax = plt.subplot(111,projection = "polar") 

ax.plot(theta,r) 
plt.show() 

enter image description here

원하는 결과를 얻으려면 0에서 2π 사이의 범위로 theta 데이터의 크기를 조정해야합니다.

theta = theta/180.*np.pi.

import matplotlib.pyplot as plt 
import numpy as np 

theta = np.arange(0,361,10) 
theta = theta/180.*np.pi 
r = np.linspace(0.,0.8,len(theta)) 
ax = plt.subplot(111,projection = "polar") 

ax.plot(theta,r) 

plt.show() 

enter image description here