Пример #1
0
def plot_ssp_legend(ax):
    """
	Draws the labels for the SN Ia DTD

	Parameters
	==========
	ax :: subplot
		The matplotlib axis object to put the legend on
	"""
    lines = 2 * [None]
    labels = [
        r"$R_\text{Ia}\propto t^{-1.1}$",
        r"$R_\text{Ia}\propto e^{-t/\tau_\text{Ia}}$"
    ]
    for i in range(2):
        lines[i] = ax.plot([1, 2], [1, 2],
                           c=visuals.colors()["black"],
                           label=labels[i],
                           linestyle=[':', '--'][i])[0]
    leg = ax.legend(loc=visuals.mpl_loc()["upper left"],
                    ncol=1,
                    bbox_to_anchor=(0.01, 0.99),
                    frameon=False)
    for i in range(2):
        lines[i].remove()
Пример #2
0
def plot_vs_metallicity_legend(ax):
    """
	Plots the legend on the late-time panel denoting the form of the adopted
	CCSN yield of Sr

	Parameters
	==========
	ax :: subplot
		The matplotlib axis object to put the legend on
	"""
    lines = 4 * [None]
    labels = [
        r"$y_\text{Sr}^\text{CC} = 0$", r"Constant $y_\text{Sr}^\text{CC}$",
        r"$y_\text{Sr}^\text{CC} \propto Z$",
        r"$y_\text{Sr}^\text{CC} \propto 1 - e^{-kZ}$"
    ]
    colors = ["black", "crimson", "lime", "deepskyblue"]
    for i in range(len(lines)):
        lines[i] = ax.plot([1, 2], [1, 2],
                           c=visuals.colors()["white"],
                           label=labels[i])[0]
    leg = ax.legend(loc=visuals.mpl_loc()["upper left"],
                    ncol=1,
                    bbox_to_anchor=(0.02, 0.98),
                    frameon=False,
                    handlelength=0)
    for i in range(len(lines)):
        lines[i].remove()
        leg.get_texts()[i].set_color(colors[i])
Пример #3
0
def legend(ax):
    """
	Draws the legend differentiating between the yield models

	Parameters
	==========
	ax :: subplot
		The matplotlib axis object to put the yield on
	"""
    lines = 3 * [None]
    colors = ["black", "deepskyblue", "crimson"]
    labels = [
        r"Constant $y_\text{Sr}^\text{CC}$",
        r"$y_\text{Sr}^\text{CC} \propto 1-e^{-kZ}$",
        r"$y_\text{Sr}^\text{CC} \propto Z$"
    ]
    for i in range(3):
        lines[i] = ax.plot([1, 2], [1, 2],
                           c=visuals.colors()["white"],
                           label=labels[i])[0]
    leg = ax.legend(loc=visuals.mpl_loc()["lower right"],
                    ncol=1,
                    bbox_to_anchor=(0.98, 0.02),
                    frameon=False,
                    handlelength=0)
    for i in range(3):
        lines[i].remove()
        leg.get_texts()[i].set_color(colors[i])
Пример #4
0
def plot_legend(ax):
    """
	Draws the legend denoting the yield assumptions

	Parameters
	==========
	ax :: subplot
		The matplotlib axis object to put the legend on
	"""
    lines = 4 * [None]
    colors = ["black", "deepskyblue", "lime", "crimson"]
    labels = [
        r"Constant $y_\text{Sr}^\text{CC}$",
        r"$y_\text{Sr}^\text{CC} \propto 1 - e^{-kZ}$",
        r"$y_\text{Sr}^\text{CC} \propto Z$", r"$y_\text{Sr}^\text{CC}$ = 0"
    ]
    for i in range(4):
        lines[i] = ax.plot([1, 2], [1, 2],
                           c=visuals.colors()["white"],
                           label=labels[i])[0]
    leg = ax.legend(loc=visuals.mpl_loc()["upper left"],
                    ncol=1,
                    bbox_to_anchor=(0.0, 0.99),
                    frameon=False,
                    handlelength=0)
    for i in range(4):
        lines[i].remove()
        leg.get_texts()[i].set_color(colors[i])
Пример #5
0
def plot_legend(ax):
    """
	Draws the legend on the axis

	Parameters
	==========
	ax :: subplot
		The matplotlib axis object to put the legend on
	"""

    # First label the studies ...
    lines = len(_STUDIES_) * [None]
    for i in range(len(lines)):
        lines[i] = ax.plot([-1, -2], [1.e-8, 1.e-6],
                           c=visuals.colors()["white"],
                           label=_NAMES_[_STUDIES_[i]])[0]
    leg = ax.legend(loc=visuals.mpl_loc()["lower right"],
                    ncol=1,
                    bbox_to_anchor=(0.99, 0.01),
                    frameon=False,
                    handlelength=0,
                    fontsize=18)
    for i in range(len(lines)):
        lines[i].remove()
        leg.get_texts()[i].set_color(_COLORS_[_STUDIES_[i]])
    ax.add_artist(leg)

    # ... then label the rotational velocities
    points = 3 * [None]
    for i in range(len(points)):
        points[i] = ax.scatter(
            [-1, -2], [1.e-8, 1.e-6],
            c=visuals.colors()["black"],
            s=50,
            marker=visuals.markers()[_MARKERS_[[0, 150, 300][i]]],
            label=r"$v_\text{rot}$ = %g km s$^{-1}$" % ([0, 150, 300][i]))
    ax.legend(loc=visuals.mpl_loc()["upper left"],
              ncol=1,
              bbox_to_anchor=(0.01, 0.99),
              frameon=False,
              fontsize=18,
              handlelength=1)
    for i in range(len(points)):
        points[i].remove()
Пример #6
0
def plot_legend(ax):
	lines = 3 * [None]
	linestyles = ['-', ':', '--']
	colors = ["red", "black", "black"]
	labels = ["Sr", r"Fe; $R_\text{Ia}\propto t^{-1.1}$",
		r"Fe; $R_\text{Ia}\propto e^{-t/\tau_\text{Ia}}$"]
	for i in range(3):
		lines[i] = ax.plot([1, 2], [1, 2], c = visuals.colors()[colors[i]],
			linestyle = linestyles[i], label = labels[i])[0]
	leg = ax.legend(loc = visuals.mpl_loc()["lower left"], ncol = 1,
		bbox_to_anchor = (0.01, 0.01), frameon = False)
	for i in range(3):
		lines[i].remove()
Пример #7
0
def draw_ofe_legend(ax):
	"""
	Draws the legend differentiating between oxygen and iron in the plot of
	[X/H] against time.

	Parameters
	==========
	ax :: subplot
		The matplotlib axis object to put the legend on
	"""
	lines = 2 * [None]
	for i in range(2):
		lines[i] = ax.plot([1, 2], [1, 2], c = visuals.colors()["black"],
			label = ["O", "Fe"][i], linestyle = ['--', '-'][i])[0]
	ax.legend(loc = visuals.mpl_loc()["upper left"], frameon = False,
		bbox_to_anchor = (0.01, 0.99))
	for i in range(2):
		lines[i].remove()
Пример #8
0
def plot_AGB_legend(ax, z):
	""" 
	Draws the legend for the AGB yields on the subplot 

	Parameters 
	========== 
	ax :: subplot 
		The matplotlib axis object to plot on 
	z :: list 
		The metallicities 
	""" 
	lines = len(z) * [None]
	for i in range(len(z)):
		lines[i] = ax.plot([1, 2], [1, 2], c = visuals.colors()["white"], 
			label = "Z = %g" % (z[i]))[0]
	leg = ax.legend(loc = visuals.mpl_loc()["upper right"], ncol = 1, 
		bbox_to_anchor = (0.99, 0.99), frameon = False, handlelength = 0)
	for i in range(len(z)):
		lines[i].remove() 
		leg.get_texts()[i].set_color(_COLORS_[i])
Пример #9
0
def main():
    """
	Produces the figure and saves it as a PDF.
	"""
    plt.clf()
    ax = setup_axis()
    data = read_data()
    for i in _NAMES_.keys():
        plot_data(ax, data, i)
    plot_vice_comparison(ax, "../../simulations/kirby2010_smooth_enh1")
    plot_vice_comparison(ax, "../../simulations/kirby2010_smooth")
    plot_vice_comparison(ax, "../../simulations/kirby2010_burst")
    plot_representative_errorbar(ax, data, "UMi")
    ax.legend(loc=visuals.mpl_loc()["upper left"],
              ncol=1,
              frameon=False,
              bbox_to_anchor=(1.02, 0.98),
              fontsize=18)
    plt.tight_layout()
    plt.savefig(sys.argv[1])
    plt.clf()