scPyviewer.set_publication_style#

scPyviewer.set_publication_style(preset='bold', palette='okabe-ito', dpi=300, base_fontsize=None, font_family='Helvetica', linewidth=None, bold_titles=None, bold_labels=False, usetex=False, editable_svg_text=True)[source]#

Apply a single, coherent publication style to all subsequent plots.

One call sets matplotlib rcParams so every plot_* shares the same look: a colour-blind-safe qualitative cycle (categorical plots adopt it via their colour fallback), perceptually-uniform viridis for continuous data, no top/right spines, white background, and editable SVG text. Two presets:

  • "bold" (default) — a bold, figures4papers-style look: 2 pt axes, 12 pt type, bold titles, black-edged bars. High-impact for talks, posters, and punchy paper panels. Applied automatically on import.

  • "nature" — Nature artwork style: thin 0.8 pt line art, compact 8 pt sans-serif, un-bolded titles. Clean and journal-ready.

These encode published guidance — Nature’s figure requirements (Arial/ Helvetica, 0.5–1 pt lines, avoid red/green and rainbow colormaps, editable vector text) and colour-vision-deficiency best practice (Okabe-Ito, viridis). No third-party code is used; scPyviewer stays MIT.

Parameters:
  • preset ({"nature", "bold"}) – Named style bundle. Individual knobs below override the preset.

  • palette (str) – Qualitative colour cycle for categorical coloring — "okabe-ito" (CVD-safe, default), "publication", or a journal palette matching a venue’s scheme: "npg" (Nature), "aaas" (Science), "nejm", "lancet", "jama".

  • dpi (int) – Default figure / save resolution (300 for print; 600 for dense panels).

  • base_fontsize (optional) – Override the preset’s base font size, axis/tick line width, or title weight. None uses the preset value.

  • linewidth (optional) – Override the preset’s base font size, axis/tick line width, or title weight. None uses the preset value.

  • bold_titles (optional) – Override the preset’s base font size, axis/tick line width, or title weight. None uses the preset value.

  • bold_labels (bool) – Bold the axis labels (kept for backward compatibility).

  • font_family (str, optional) – Preferred font, prepended to the sans-serif stack (degrades to Arial/DejaVu Sans). None keeps the current family.

  • usetex (bool) – Render text with LaTeX (needs a LaTeX install). Off by default.

  • editable_svg_text (bool) – Keep SVG text selectable (not outlined) so labels stay editable in Illustrator/Inkscape.

Return type:

None

Examples

>>> import scPyviewer as sv
>>> sv.set_publication_style()                      # Nature-clean (default)
>>> sv.set_publication_style("bold", dpi=600)       # talks / posters
>>> sv.set_publication_style(palette="publication") # alternate palette