5

私はこれらのような単純なステレオグラフィック太陽経路図を作成しようとしています: http ://wiki.naturalfrequency.com/wiki/Sun-Path_Diagram

極座標プロットを回転させ、スケールを90に設定できます。y軸を反転するにはどうすればよいですか?現在、軸は0> 90になっていますが、方位角を表すために軸を90> 0に反転するにはどうすればよいですか?

私が試してみました:

ax.invert_yaxis()
ax.yaxis_inverted()

さらに、等距離ではなく立体投影を作成するにはどうすればよいですか?

私のコード:

import matplotlib.pylab as plt
testFig = plt.figure(1, figsize=(8,8))
rect = [0.1,0.1,0.8,0.8]
testAx = testFig.add_axes(rect,polar=True)
testAx.invert_yaxis()
testAx.set_theta_zero_location('N')
testAx.set_theta_direction(-1)

Azi = [90,180,270]
Alt= [0,42,0]
testAx.plot(Azi,Alt)
plt.show()

現在、私のコードは線を正しくプロットしていないようですが、角度または度を別のものに変換する必要がありますか?

どんな助けでも大歓迎です。

4

1 に答える 1

7

やっと matplotlib をいじる時間ができました。多くの検索の後、Joe Kington が指摘する正しい方法は、Axes をサブクラス化することです。優れた basemap モジュールを利用する、はるかに迅速な方法を見つけました。

以下は、stackoverflow 用に調整したコードです。太陽の高度と方位角は、pandas で作成された一連の時系列スタンプを使用して Pysolar で計算されました。

import matplotlib.pylab as plt
from mpl_toolkits.basemap import Basemap
import numpy as np

winterAzi = datafomPySolarAzi
winterAlt = datafromPySolarAlt

# 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')

現在、私は点をプロットしているだけであることに注意してください。線の点が日の出/日の入り時に alt 0 にあることを確認する必要があります。

ステレオグラフ プロット、注意してください。冬至と夏至、秋分をプロットしました。

于 2013-01-10T17:33:29.020 に答える