%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
data = pd.read_table('data/dr1.sample', delimiter=',')
data.head()
ra | dec | mag2 | |
---|---|---|---|
0 | 332.202274 | -2.056767 | 17.12 |
1 | 332.471576 | -2.085015 | 18.10 |
2 | 332.368745 | -1.955771 | 16.64 |
3 | 332.206665 | -1.868653 | 17.19 |
4 | 332.348725 | -2.136096 | 16.21 |
data.ra
0 332.202274 1 332.471576 2 332.368745 3 332.206665 4 332.348725 5 332.444417 6 332.222379 7 332.351381 8 332.506374 9 332.244417 10 331.551234 11 331.768314 12 331.621652 13 331.772340 14 331.656890 15 331.753596 16 331.721996 17 331.645975 18 331.777682 19 331.755536 20 331.573480 21 331.829413 22 331.568160 23 331.854516 24 331.812125 25 331.730088 26 331.789860 27 331.764592 28 331.672794 29 331.698572 ... 969 333.422293 970 333.780378 971 333.612375 972 333.578496 973 333.416844 974 333.516416 975 333.360288 976 333.105776 977 333.337832 978 333.367444 979 333.250518 980 333.140347 981 333.132170 982 332.824680 983 333.047730 984 332.794817 985 332.925200 986 333.022310 987 332.929870 988 333.052310 989 332.842742 990 332.937900 991 333.088170 992 332.975800 993 332.964376 994 332.904375 995 332.857210 996 332.891050 997 333.020110 998 333.113113 Name: ra, dtype: float64
from astropy import units as u
from astropy.coordinates import Angle
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
axes.scatter(data['ra'], data['dec'], s = data['mag2'])
xticks = axes.get_xticks()
yticks = axes.get_yticks()
xt = ["$%.1f^{\circ}$"%n for n in xticks.tolist()]
yt = ["$%.1f^{\circ}$"%n for n in yticks.tolist()]
xt,yt
axes.set_xticklabels(xt)
axes.set_yticklabels(yt)
[<matplotlib.text.Text at 0x10d447198>, <matplotlib.text.Text at 0x10d44bc50>, <matplotlib.text.Text at 0x10d472a20>, <matplotlib.text.Text at 0x10d455048>, <matplotlib.text.Text at 0x10d4474a8>, <matplotlib.text.Text at 0x10d43dcc0>, <matplotlib.text.Text at 0x10d4ac748>, <matplotlib.text.Text at 0x10d4b20f0>, <matplotlib.text.Text at 0x10d4b2b00>]