From af1d770136ba1c0fbfd57992570804446d247deb Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 6 Dec 2017 20:47:49 +0800 Subject: Adjust plot axis label style a bit --- astro/calc_psd.py | 4 ++-- astro/eor_window.py | 4 ++-- astro/ps1d_eorwindow.py | 5 +++-- astro/ps2d.py | 8 ++++---- 4 files changed, 11 insertions(+), 10 deletions(-) (limited to 'astro') diff --git a/astro/calc_psd.py b/astro/calc_psd.py index e4280c1..e15d1a9 100755 --- a/astro/calc_psd.py +++ b/astro/calc_psd.py @@ -261,7 +261,7 @@ class PSD: ax.set(xscale="log", yscale="log", xlim=(xmin, xmax), ylim=(ymin, ymax), title="Radial (Azimuthally Averaged) Power Spectral Density", - xlabel=r"k [%s$^{-1}$]" % self.pixel[1], + xlabel=r"$k$ [%s$^{-1}$]" % self.pixel[1], ylabel=ylabel) ax.legend() @@ -276,7 +276,7 @@ class PSD: x1_min, x1_max = ax.get_xlim() x2_min, x2_max = x1_min*self.pixel[0], x1_max*self.pixel[0] ax2.set_xlim(x2_min, x2_max) - ax2.set_xlabel(r"k [pixel$^{-1}$] (1 pixel = %.2f %s)" % + ax2.set_xlabel(r"$k$ [pixel$^{-1}$] (1 pixel = %.2f %s)" % self.pixel) ax2.grid(False) # Raise title position to avoid overlapping diff --git a/astro/eor_window.py b/astro/eor_window.py index 71f4cc2..4ea180e 100755 --- a/astro/eor_window.py +++ b/astro/eor_window.py @@ -291,8 +291,8 @@ class PS2D: # ax.set(xscale="log", yscale="log", xlim=(x[1], x[-1]), ylim=(y[1], y[-1]), - xlabel=r"k$_{\perp}$ [Mpc$^{-1}$]", - ylabel=r"k$_{||}$ [Mpc$^{-1}$]", + xlabel=r"$k_{\perp}$ [Mpc$^{-1}$]", + ylabel=r"$k_{||}$ [Mpc$^{-1}$]", title=title) cb = ax.figure.colorbar(mappable, ax=ax, pad=0.01, aspect=30) cb.ax.set_xlabel("[%s]" % self.unit) diff --git a/astro/ps1d_eorwindow.py b/astro/ps1d_eorwindow.py index d04231b..e364fcb 100755 --- a/astro/ps1d_eorwindow.py +++ b/astro/ps1d_eorwindow.py @@ -156,10 +156,11 @@ class PS1D: ncell = len(data) if ncell > 0: ps1d[i, 1] = np.mean(data) + # XXX: how to properly estimate the errors??? ps1d[i, 2] = np.sqrt(np.sum(errors ** 2)) / ncell if normalize: - # XXX is this normalization correct??? + # XXX: is this normalization correct??? coef = ps1d_k**3 / (2*np.pi**2) ps1d[:, 1] *= coef ps1d[:, 2] *= coef @@ -207,7 +208,7 @@ class PS1D: ax.errorbar(x[1:], y[1:], yerr=yerr[1:], fmt="none") ax.plot(x[1:], y[1:], marker="o") ax.set(xscale="log", yscale="log", - xlabel=r"k [Mpc$^{-1}$]", ylabel=ylabel, + xlabel=r"$k$ [Mpc$^{-1}$]", ylabel=ylabel, title="1D Spherically Averaged Power Spectrum") return ax diff --git a/astro/ps2d.py b/astro/ps2d.py index 00bc0af..ac98734 100755 --- a/astro/ps2d.py +++ b/astro/ps2d.py @@ -289,8 +289,8 @@ class PS2D: vmin, vmax = mappable.get_clim() ax.set(xscale="log", yscale="log", xlim=(x[1], x[-1]), ylim=(y[1], y[-1]), - xlabel=r"k$_{\perp}$ [Mpc$^{-1}$]", - ylabel=r"k$_{||}$ [Mpc$^{-1}$]", + xlabel=r"$k_{\perp}$ [Mpc$^{-1}$]", + ylabel=r"$k_{||}$ [Mpc$^{-1}$]", title=title) cb = ax.figure.colorbar(mappable, ax=ax, pad=0.01, aspect=30) cb.ax.set_xlabel(r"[%s$^2$ Mpc$^3$]" % self.unit) @@ -302,8 +302,8 @@ class PS2D: mappable.set_clim(vmin, vmax) ax_err.set(xscale="log", yscale="log", xlim=(x[1], x[-1]), ylim=(y[1], y[-1]), - xlabel=r"k$_{\perp}$ [Mpc$^{-1}$]", - ylabel=r"k$_{||}$ [Mpc$^{-1}$]", + xlabel=r"$k_{\perp}$ [Mpc$^{-1}$]", + ylabel=r"$k_{||}$ [Mpc$^{-1}$]", title=title_err) cb = ax_err.figure.colorbar(mappable, ax=ax_err, pad=0.01, aspect=30) cb.ax.set_xlabel(r"[%s$^2$ Mpc$^3$]" % self.unit) -- cgit v1.2.2