cosmic_toolbox.styles package
Submodules
cosmic_toolbox.styles.base module
- class cosmic_toolbox.styles.base.PaperStyle[source]
Bases:
object- FONT_SIZE: int = 10
- GOLDEN = 1.618033988749895
- LATEX_PREAMBLE: str = '\\usepackage{amsmath}\\usepackage{amssymb}\\usepackage{bm}'
- PT_PER_INCH = 72.27
- TEXTHEIGHT_PT: float | None = None
- TEXTWIDTH_PT: float = 510.0
- classmethod fig(width: float | str = 1.0, aspect: float | None = None, **kwargs)[source]
- Single-panel figure. Returns (fig, ax)
- param width:
fraction of textwidth as float, 0.5 = half, 1.0 = full or inches as a string “3.5in”
- Parameters:
aspect – height / width, default 1/golden ≈ 0.618
- Returns:
(fig, ax)
- classmethod fig_grid(nrows: int = 1, ncols: int = 2, width: float | str = 1.0, aspect: float | None = None, **kwargs)[source]
Multi-panel figure. Returns (fig, axes). :param nrows: number of rows :param ncols: number of columns :param width: fraction of textwidth as float, 0.5 = half, 1.0 = full
or inches as a string “3.5in”
- Parameters:
aspect – height / width, default 1/golden ≈ 0.618
- Returns:
(fig, axes)
- classmethod fig_size(width: float | str = 1.0, aspect: float | None = None)[source]
Return (width_in, height_in) for a figure.
- Parameters:
width – fraction of textwidth as float, 0.5 = half, 1.0 = full or inches as a string “3.5in”
aspect – height / width, default 1/golden ≈ 0.618
- Returns:
(width_in, height_in)
- classmethod set_mpl(use_latex: bool | None = None)[source]
Apply this journal’s rcParams globally.
- Parameters:
use_latex – whether to use LaTeX for text rendering. If None (default), will auto-detect if LaTeX is available on the system and fall back to mathtext if not. Note that LaTeX must be installed for publication-quality figures, so it’s recommended to install it and let the function auto-detect it.
cosmic_toolbox.styles.jcap module
- class cosmic_toolbox.styles.jcap.JCAP[source]
Bases:
PaperStyle- JCAP style for:
documentclass[a4paper,11pt]{article} usepackage{jcappub}
Textwidth measured with thetextwidth → 440.0 pt
- FONT_SIZE: int = 11
- LATEX_PREAMBLE: str = '\\usepackage{amsmath}\\usepackage{amssymb}\\usepackage{bm}'
- TEXTWIDTH_PT: float = 440.0