SciencePlots

raw JSON →
2.2.1 verified Fri May 01 auth: no python

SciencePlots provides Matplotlib style sheets for scientific publications, offering preconfigured plots that match journal requirements (IEEE, Nature, etc.) and high-contrast color cycles. It requires an explicit `import scienceplots` statement (since v1.1.0). Current version is 2.2.1, with a relatively slow release cadence (every few months). Requires Python >=3.8.

pip install scienceplots
error AttributeError: module 'matplotlib.style' has no attribute 'use' (if import missing)
cause You forgot `import scienceplots` before using `plt.style.use('science')`.
fix
Add import scienceplots at the top of your script.
error FileNotFoundError: [Errno 2] No such file or directory: '.../styles/science.mplstyle'
cause SciencePlots is not installed or styles not registered (often because `import scienceplots` is missing).
fix
Install scienceplots (pip install scienceplots) and import scienceplots in your script.
error RuntimeError: Failed to process string with tex because LaTeX is not installed or missing packages
cause The 'science' style tries to use LaTeX but LaTeX is not installed.
fix
Use plt.style.use(['science', 'no-latex']) to disable LaTeX, or install a LaTeX distribution (e.g., TeX Live, MiKTeX).
error UserWarning: Style 'science' does not exist; falling back to default
cause Typo in style name or styles not registered (missing import).
fix
Verify style name (e.g., 'science', 'ieee') and ensure import scienceplots is executed.
deprecated Old usage without explicit `import scienceplots` no longer works since v1.1.0.
fix Add `import scienceplots` at the top of your script.
gotcha The default 'science' style requires LaTeX. If LaTeX is not installed, you'll get errors about missing `*.sty` files.
fix Use `plt.style.use(['science', 'no-latex'])` to avoid LaTeX dependency.
gotcha Styles are case-sensitive. Using `'SCIENCE'` or `'Science'` will fail silently (falls back to default).
fix Use exact style names as documented: `'science'`, `'ieee'`, `'nature'`, etc.
gotcha Combining styles with conflicting settings (e.g., two styles setting 'figure.facecolor') results in last style winning; order matters.
fix Put the most specific style last in the list: `plt.style.use(['science', 'ieee'])` — 'ieee' overrides 'science' on conflicts.
gotcha Fonts may not appear as expected if the required LaTeX packages (like 'amsmath', 'sfmath') are missing; styles load them automatically.
fix Ensure your LaTeX distribution is complete, or use `'no-latex'` styles.
conda install -c conda-forge scienceplots

Import scienceplots to register styles, then use `plt.style.use(...)` like any Matplotlib style.

import matplotlib.pyplot as plt
import scienceplots

# Apply 'science' style (uses LaTeX)
plt.style.use('science')

# Or without LaTeX:
# plt.style.use(['science', 'no-latex'])

fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 4, 9])
ax.set_xlabel('x')
ax.set_ylabel('y')
fig.savefig('figure.pdf')