plot_style — Publication-quality Matplotlib style

plot_style sets a consistent Matplotlib style for all paper figures. Call apply() once at the top of each figure notebook before creating any axes.

Wong colour palette

All figures use the Wong (2011) eight-colour palette, which is optimised for colour-blind accessibility:

from foregrounds_diffusion.plot_style import WONG

# WONG[0] = black, WONG[1] = orange, WONG[2] = sky blue, ...
ax.plot(x, y, color=WONG[1])

Setting figure size

Pass the journal column width in points. Common values:

Journal

Single column

Double column

MNRAS

246 pt

510 pt

ApJ

242 pt

513 pt

from foregrounds_diffusion.plot_style import apply

apply(fig_width_pt=246.0)            # MNRAS single column
apply(fig_width_pt=510.0, n_cols=2)  # MNRAS double column, 2-panel figure

Save convention

Always save as both PDF (primary, lossless) and PNG (backup, 300 dpi):

fig.savefig(FIGURES_DIR / "fig01_cib_power_spectrum.pdf")
fig.savefig(FIGURES_DIR / "fig01_cib_power_spectrum.png", dpi=300)

API

Matplotlib style baseline for publication-quality figures.

Usage (at the top of every paper-figure notebook):

from foregrounds_diffusion.plot_style import apply, WONG apply(fig_width_pt=246.0) # MNRAS single column apply(fig_width_pt=510.0, n_cols=2) # MNRAS double column

Save convention (always PDF primary, PNG backup):

fig.savefig(FIGURES_DIR / “fig01_cib_fullsky.pdf”) fig.savefig(FIGURES_DIR / “fig01_cib_fullsky.png”, dpi=300)

foregrounds_diffusion.plot_style.apply(fig_width_pt=246.0, n_cols=1)[source]

Set rcParams for publication-quality figures.

Parameters:
  • fig_width_pt – Journal text width in points. 246 pt ≈ MNRAS single column; 510 pt ≈ MNRAS double column. Pass the LaTeX textwidth value.

  • n_cols – Figure column span (1 or 2). Width is multiplied accordingly so fig_width_pt=246, n_cols=2 gives a figure spanning both columns.

Return type:

list[str]

Returns:

list[str] – The WONG colour palette, for convenience (avoids a second import).

Parameters:
  • fig_width_pt (float)

  • n_cols (int)