1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| import matplotlib.transforms as mtransforms import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost
obs = [["01_S1", 3.88, 0.14, 1970, 63], ["01_S4", 5.6, 0.82, 1622, 150], ["02_S1", 2.4, 0.54, 1570, 40], ["03_S1", 4.1, 0.62, 2380, 170]]
fig = plt.figure()
ax_kms = SubplotHost(fig, 1, 1, 1, aspect=1.)
pm_to_kms = 1./206265.*2300*3.085e18/3.15e7/1.e5
aux_trans = mtransforms.Affine2D().scale(pm_to_kms, 1.) ax_pm = ax_kms.twin(aux_trans) ax_pm.set_viewlim_mode("transform")
fig.add_subplot(ax_kms)
for n, ds, dse, w, we in obs: time = ((2007 + (10. + 4/30.)/12) - 1988.5) v = ds / time * pm_to_kms ve = dse / time * pm_to_kms ax_kms.errorbar([v], [w], xerr=[ve], yerr=[we], color="k")
ax_kms.axis["bottom"].set_label("Linear velocity at 2.3 kpc [km/s]") ax_kms.axis["left"].set_label("FWHM [km/s]") ax_pm.axis["top"].set_label(r"Proper Motion [$''$/yr]") ax_pm.axis["top"].label.set_visible(True) ax_pm.axis["right"].major_ticklabels.set_visible(False)
ax_kms.set_xlim(950, 3700) ax_kms.set_ylim(950, 3100)
plt.show()
|