gitmyhub

SciencePlots

Python ★ 9.0k updated 3mo ago

Matplotlib styles for scientific plotting

A Python package that applies publication-ready styles to Matplotlib charts with a single line of code, including presets for IEEE papers, Nature articles, and color-blind-safe palettes.

PythonMatplotlibLaTeXsetup: moderatecomplexity 2/5

SciencePlots is a Python package that provides pre-built visual styles for making charts and graphs look appropriate for scientific papers, presentations, and theses. It works with Matplotlib, a widely used Python charting library, by giving you style presets you can apply to your plots with a single line of code.

The core style is called "science" and is designed to produce clean, publication-quality figures. You can layer additional styles on top of it to match the requirements of specific academic journals. There are styles tailored for IEEE papers, which require figures to remain readable in black and white and fit within a single column, and for Nature articles, which call for sans-serif fonts. Styles can be mixed and matched, and you can apply them temporarily to just one section of your code if you do not want them to affect the entire script.

The package also includes a set of alternative color cycles, including options that are safe for people with color blindness. There is a collection based on Paul Tol's discrete rainbow color sets with configurations for different numbers of distinct colors.

Language support is another feature: SciencePlots includes styles for labels and text in Traditional Chinese, Simplified Chinese, Japanese, Korean, Russian, and Turkish. These require separate font installations described in the project's documentation.

Installation is available through pip or conda. One prerequisite is a working LaTeX installation, since the styles use LaTeX for text rendering by default. A no-LaTeX style option exists for environments where LaTeX is not available.

Where it fits