在matplotlib / pyplot

时间:2019-11-07 11:53:18

标签: python matplotlib

我显示了投射在天空上的星系目录。这是模拟数据和代码示例:

# Generating mock data
np.random.seed(1234)
(RA,Dec)=(np.random.rand(100)*60 for _ in range(2))

# Creating projection
projection='mollweide'
fig = plt.figure(figsize=(20, 10));
ax = fig.add_subplot(111, projection=projection);

ax.scatter(np.radians(RA),np.radians(Dec)); 

# Creating axes
xtick_labels = ["$150^{\circ}$", "$120^{\circ}$", "$90^{\circ}$", "$60^{\circ}$", "$30^{\circ}$", "$0^{\circ}$", 
                "$330^{\circ}$", "$300^{\circ}$", "$270^{\circ}$", "$240^{\circ}$", "$210^{\circ}$"]
labels = ax.set_xticklabels(xtick_labels, fontsize=15);     
ytick_labels = ["$-75^{\circ}$", "$-60^{\circ}$", "$-45^{\circ}$", "$-30^{\circ}$", "$-15^{\circ}$", "$0^{\circ}$",
                "$15^{\circ}$", "$30^{\circ}$", "$45^{\circ}$", "$60^{\circ}$", "$75^{\circ}$", "$90^{\circ}$"]
ax.set_yticklabels(ytick_labels,fontsize=15);     
ax.set_xlabel("RA");
ax.xaxis.label.set_fontsize(20);
ax.set_ylabel("Dec");
ax.yaxis.label.set_fontsize(20);
ax.grid(True);

结果如下:

我想:

  1. 进行缩放,以便仅显示投影的相关部分(在此示例中,为[[0,60],[0,60])部分)-同时仍显示斧头标签(“ RA “)

  2. 将RA刻度标签从斧头上方移到下方,因为它对真实数据不可读。我尝试了各种Matplotlib控件,但在投影模式下不起作用。

0 个答案:

没有答案