所以我无法得到多普勒Map的极面图。下面是设置:
phis = np.linspace(0.0001,50,51)
thetas = np.linspace(0,360,721)
doppMap = \
np.array([[doppler(i * deg, j * deg).value for i in thetas] for j in phis]) * units.kHz
字符串
所以我现在有一个二维阵列的多普勒值从0-360在θ,从0-50在φ…如果我在笛卡尔坐标系中绘制它,它看起来像我所期望的那样:
x1c 0d1x的数据
这适用于对pcolomesh
的两个不同调用:
fig, ax = plt.subplots(figsize=(8,4))
X, Y = np.meshgrid(thetas, phis) # Create a grid over the range of bins for the plot
im = (ax.pcolormesh(thetas, phis, doppMap, cmap=mpl.cm.jet_r, alpha=0.95,shading='auto',edgecolors='face') )
## or
im = (ax.pcolormesh(X, Y, doppMap, cmap=mpl.cm.jet_r, alpha=0.95,shading='auto',edgecolors='face') )
ax.set_xlabel("theta [$\degree$]",fontsize=14)
ax.set_ylabel("phi [$\degree$]",fontsize=14)
ax.set_xticks([x*30 for x in range(360//30)])
ax.grid(True)
plt.xticks(fontsize=14)
plt.yticks(fontsize=14)
## Add colorbar
cbar_ax = fig.add_axes([0.95, 0.15, 0.015, 0.7])
cbar = fig.colorbar(im, cax=cbar_ax)
cbar.ax.tick_params(labelsize=14)
#cbar.ax.set_yticklabels(['1', '2', '4', '6', '10', maxCV], size=24)
#cbar.set_label(r"log ($P(\overline{Z_{G}} /Z_{\odot})$ / $d(M_{G}/M_{\odot})$)",fontsize=36)
cbar.set_label(r"$d$f [kHz]",fontsize=24)
gc.collect()
型
但是,当我尝试这个:
fig, ax = plt.subplots(figsize=(8,7),subplot_kw=dict(projection='polar'))
X, Y = np.meshgrid(thetas,phis) # Create a grid over the range of bins for the plot
im = (ax.pcolormesh(thetas,phis, doppMap, cmap=mpl.cm.jet_r, alpha=0.95,shading='auto',edgecolors='face') )
## or
im = (ax.pcolormesh(X, Y, doppMap, cmap=mpl.cm.jet_r, alpha=0.95,shading='auto',edgecolors='face') )
ax.set_theta_direction(-1)
ax.set_theta_offset(np.pi / 2.0)
plt.thetagrids([theta * 15 for theta in range(360//15)])
ax.grid(True)
plt.xticks(fontsize=14)
plt.yticks(fontsize=14)
## Add colorbar
cbar_ax = fig.add_axes([0.95, 0.15, 0.015, 0.7])
cbar = fig.colorbar(im, cax=cbar_ax)
cbar.ax.tick_params(labelsize=14)
#cbar.ax.set_yticklabels(['1', '2', '4', '6', '10', maxCV], size=24)
#cbar.set_label(r"log ($P(\overline{Z_{G}} /Z_{\odot})$ / $d(M_{G}/M_{\odot})$)",fontsize=36)
cbar.set_label(r"$d$f [kHz]",fontsize=24)
gc.collect()
型
我认为这是完全错误的:
的
有人知道我哪里做错了吗?
谢谢
1条答案
按热度按时间pxyaymoc1#
所以我想明白了...外轴是弧度!
字符串
结果
x1c 0d1x的数据