In [1]:
import matplotlib as plt
%matplotlib inline

In [39]:
def make_mw_lit_plot(ax, dat):
    labels_leg = []
    labels = []
    yticks = []
    colors = []
    leg = []
    for line in dat:
        labels_leg.append(line[0])
        labels.append(line[7])
        x = [line[1]]
        y = [line[2]]
        yticks.append(line[2])
        xerr = [[line[3]], [line[4]]]
        fmt = line[5]
        ecolor = line[6]
        color = line[6]
        leg.append(ax.errorbar(x=x, y=y, xerr=xerr, fmt=fmt, ecolor=ecolor, color=color))
    ax.set_yticks(yticks)
    ax.set_yticklabels(labels)
    ax.set_xlim((0,6))
    ax.set_ylim((3,10))
    return labels_leg, leg

In [40]:
# label, x, y, xerrlo, xerrhi, fmt, color
#["Gonzalez 13", 1.15, num-4, .26, 2.34, 'v', 'magenta', 'Mag Cl'] M200

num = 8
dat = [["Williamson 15", .87, num+1, .30, .30, 'o', 'magenta', 'Quads'],["Williamson 15", .52, num, .32, .65, 'o', 'magenta', 'Pairs'],\
       ["Penarrubia 15", 1.04, num-1, .23, .26, '^', 'b', 'LV dynamics'], ["Kafle 14", .8, num-2, .16, .31, '*', 'r', 'Halo Stars'],\
       ["Busha 11", 1.2, num-3, .7, 1.0, '^', 'magenta', 'Mag Cl'], ["Li&White 08", 1.57, num-4, .2, .2, 'o', 'k', 'Timing']]

In [41]:
fig = figure()
ax = fig.gca()
lab, leg=make_mw_lit_plot(ax, dat)



In [42]:
ax.set_xticks(np.arange(0,6,.5))


Out[42]:
[<matplotlib.axis.XTick at 0x40fbd50>,
 <matplotlib.axis.XTick at 0x4012c90>,
 <matplotlib.axis.XTick at 0x46f4990>,
 <matplotlib.axis.XTick at 0x46f4f50>,
 <matplotlib.axis.XTick at 0x46f76d0>,
 <matplotlib.axis.XTick at 0x46f7e10>,
 <matplotlib.axis.XTick at 0x4842410>,
 <matplotlib.axis.XTick at 0x46f7f50>,
 <matplotlib.axis.XTick at 0x46ee750>,
 <matplotlib.axis.XTick at 0x40f6190>,
 <matplotlib.axis.XTick at 0x44b8c90>,
 <matplotlib.axis.XTick at 0x44aad90>]

In [43]:
for label in ax.xaxis.get_ticklabels()[::2]:
    label.set_visible(False)

In [44]:
fig


Out[44]:

In [45]:
ax.legend(list(leg[::1]), list(lab), scatterpoints=0, loc='upper right', ncol=1, fontsize=8)


Out[45]:
<matplotlib.legend.Legend at 0x46f1790>

In [46]:
fig


Out[46]:

In [47]:
fig.suptitle("MW Mass Comparison")


Out[47]:
<matplotlib.text.Text at 0x400ab50>

In [48]:
ax.set_xlabel("$M_{vir}[10^{12}M_{\odot}]$")


Out[48]:
<matplotlib.text.Text at 0x40f8950>

In [51]:
fig


Out[51]:

In [52]:
fig.savefig('/afs/slac.stanford.edu/u/ki/mwillia1/Thesis/LocalGroupHaloProps/MW_results.pdf', dpi=800)

In [ ]: