0
matplolib, basemap 및 numpy를 사용하여 Python의 극좌표에서 방위각 및 고도 포인트를 플로팅하려고합니다.천문학을위한 파이썬의 극좌표
winterAzi = 81.67440007, 75.55094006, 67.57616189, 55.73337697
winterAlt = 11.28088118, 25.0837551, 38.44986883, 50.8769649
#create instance of basemap, note we want a south polar projection to 90 = E
myMap = Basemap(projection='spstere',boundinglat=0,lon_0=180,resolution='l',round=True,suppress_ticks=True)
# set the grid up
gridX,gridY = 10.0,15.0
parallelGrid = np.arange(-90.0,90.0,gridX)
meridianGrid = np.arange(-180.0,180.0,gridY)
# draw parallel and meridian grid, not labels are off. We have to manually create these.
myMap.drawparallels(parallelGrid,labels=[False,False,False,False])
myMap.drawmeridians(meridianGrid,labels=[False,False,False,False],labelstyle='+/-',fmt='%i')
# we have to send our values through basemap to convert coordinates, note -winterAlt
winterX,winterY = myMap(winterAzi,-winterAlt)
# plot azimuth labels, with a North label.
ax = plt.gca()
ax.text(0.5,1.025,'N',transform=ax.transAxes,horizontalalignment='center',verticalalignment='bottom',size=25)
for para in np.arange(gridY,360,gridY):
x= (1.1*0.5*np.sin(np.deg2rad(para)))+0.5
y= (1.1*0.5*np.cos(np.deg2rad(para)))+0.5
ax.text(x,y,u'%i\N{DEGREE SIGN}'%para,transform=ax.transAxes,horizontalalignment='center',verticalalignment='center')
# plot the winter values
myMap.plot(winterX,winterY ,'bo')
plt.show()
그러나 코드 시작 부분에 데이터 포인트를 플로팅하지 않습니다! 어떻게 그럴 수 있습니까?
또 다른 질문을하지만! 다음과 같은 방법으로 np.array를 사용할 수 있습니까? 범위가 n 인 경우 (x에서 y까지) : ;; winterAzi = np.array ([func (x, y, 1)])) ;; winterAlt = np.array ([func (x, y, 2)])? – Vick
당신이 무엇을하려고하는지 잘 모르겠지만리스트 comprehensions를 시도해 볼 수 있습니다 :'winterAzi = np.array ([n (range, (x, y)]의 n에 대해 func (n, 1))) ;; winterAlt = np.array (범위 (x, y)의 n에 대해 [func (n, 2)])' –