pipeline
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy +…
plotnine static visualization (ggplot2 syntax for Python). Geoms, aesthetics, scales, coordinates, facets, themes. Use for static publication-quality figures with grammar-of-graphics syntax. For interactive charts use plotly; for maps use geopandas.
Claude Code
$ npx -y skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill plotnine --agent claude-code
Codex
$ npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill plotnine -a codex -y
Cursor
$ npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill plotnine -a cursor -y
Gemini CLI
$ npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill plotnine -a gemini-cli -y
GitHub Copilot
$ npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill plotnine -a github-copilot -y
OpenCode
$ npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill plotnine -a opencode -y
Windsurf
$ npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill plotnine -a windsurf -y
name: plotnine description: >- plotnine static visualization (ggplot2 syntax for Python). Geoms, aesthetics, scales, coordinates, facets, themes. Use for static publication-quality figures with grammar-of-graphics syntax. For interactive charts use plotly; for maps use geopandas. metadata: audience: research-coders domain: python-library library-version: "0.15.x" skill-last-updated: "2026-03-26"
plotnine static visualization library for Python, implementing the grammar of graphics (ggplot2 syntax). Covers geoms (point, line, bar, histogram, boxplot, smooth), aesthetics, scales, coordinates, facets, and themes. Use when creating static publication-quality figures with ggplot2-style syntax, producing charts for print or reports, or working with an R ggplot2 background. Prefer over plotly when static output is needed.
Quick reference for creating data visualizations with plotnine, a Python implementation of the grammar of graphics (ggplot2).
plotnine is a data visualization library based on the **grammar of graphics**:
| File | Purpose | When to Read | |------|---------|--------------| | `quickstart.md` | Installation, imports, basic syntax | Starting out | | `geoms.md` | Geometric objects (points, lines, bars) | Choosing chart types | | `aesthetics.md` | Mapping data to visual properties | Customizing appearance | | `scales-coords.md` | Scales, coordinates, positions | Axis/color control | | `facets-themes.md` | Multi-panel plots and styling | Layout and themes | | `gotchas.md` | Common errors and best practices | Debugging |
What kind of plot? ├─ Scatter plot (geom_point) → ./references/geoms.md ├─ Line plot (geom_line) → ./references/geoms.md ├─ Bar chart (geom_bar, geom_col) → ./references/geoms.md ├─ Histogram (geom_histogram) → ./references/geoms.md ├─ Box plot (geom_boxplot) → ./references/geoms.md └─ Other geoms → ./references/geoms.md
What to customize? ├─ Colors, sizes, shapes → ./references/aesthetics.md ├─ Axis limits/labels → ./references/scales-coords.md ├─ Color palettes → ./references/scales-coords.md ├─ Overall theme → ./references/facets-themes.md ├─ Title/labels → ./references/facets-themes.md └─ Multiple panels (faceting) → ./references/facets-themes.md
Common issues? ├─ Plot not showing → ./references/quickstart.md ├─ Column not found → ./references/gotchas.md ├─ Color not applying → ./references/aesthetics.md ├─ Unexpected grouping → ./references/gotchas.md └─ Syntax errors → ./references/gotchas.md
**Important:** In data research pipelines (see `CLAUDE.md`), all visualizations are generated through **script files** in `scripts/stage8_analysis/`, not interactively. This ensures auditability and reproducibility.
**The pattern:** 1. Write plot code to `scripts/stage8_analysis/{step}_{plot-name}.py` 2. Execute via Bash with automatic output capture wrapper script 3. Validation results get automatically embedded in scripts as comments 4. If failed, create versioned copy for fixes
Closely read `agent_reference/SCRIPT_EXECUTION_REFERENCE.md` for the mandatory file-first execution protocol covering complete code file writing, output capture, and file versioning rules.
**See:**
The examples below show plotnine syntax. In research workflows, wrap them in scripts following the file-first pattern.
---
from plotnine import ggplot, aes, geom_point
(
ggplot(df, aes(x="col_x", y="col_y"))
+ geom_point()
)from plotnine import * # All components from plotnine.data import mtcars # Built-in datasets
| Geom | Use Case | |------|----------| | `geom_point()` | Scatter plots | | `geom_line()` | Line plots | | `geom_bar()` | Count bars | | `geom_col()` | Value bars | | `geom_histogram()` | Distributions | | `geom_boxplot()` | Box plots | | `geom_smooth()` | Trend lines |
| Aesthetic | Controls | |-----------|----------| | `x`, `y` | Position | | `color` | Point/line color | | `fill` | Area fill color | | `size` | Point/line size | | `shape` | Point shape | | `alpha` | Transparency |
p = ggplot(df, aes("x", "y")) + geom_point()
p.save("plot.png", width=10, height=8, dpi=300)| Topic | Reference File | |-------|---------------| | Installation | `./references/quickstart.md` | | Basic syntax | `./references/quickstart.md` | | Chart types | `./references/geoms.md` | | Data mapping | `./references/aesthetics.md` | | Color/shape values | `./references/aesthetics.md` | | Axis scales | `./references/scales-coords.md` | | Color scales | `./references/scales-coords.md` | | Coordinates | `./references/scales-coords.md` | | Faceting | `./references/facets-themes.md` | | Themes | `./references/facets-themes.md` | | Labels/titles | `./references/facets-themes.md` | | Common errors | `./references/gotchas.md` | | Best practices | `./references/gotchas.md` |
When this library is used as a primary analytical tool, include in the report's Software & Tools references:
> Kibirige, H. et al. plotnine: Grammar of graphics for Python [Computer software]. https://plotnine.org/
**Cite when:** plotnine is the primary visualization library producing figures included in the report. **Do not cite when:** Only used for quick exploratory plots not inclu
## 🔥 力荐 · StatsPAI — Stata 与 R 的 Python 平替,为 AI Agent 而生 🔁 Stata / R 平替:reghdfe、csdid、rdrobust、synth、fixest、did 等常用命令在 Python 中一站式替代,一个 import statspai as sp 搞定 DID / RD / IV / SCM / DML / matching 🤖 面向 Agent 设计:结构化结果对象 + 内置 MCP Server,Claude / Codex
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy +…
Use when the user asks to run a full empirical / causal analysis in Python — by default in the style of an applied economics…
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy +…
Classical end-to-end empirical analysis workflow in the traditional Stata ecosystem — native Stata + reghdfe + ivreg2 + csdid +…
Classical end-to-end empirical analysis workflow in the modern tidyverse + econometrics R ecosystem — dplyr + tidyr + haven +…
Systematic writing framework for philosophy and interdisciplinary academic papers from optimized outline to submission-ready…
Direct browser control via CDP for web interaction: automation, scraping, testing, screenshots, and site/app work. Also covers…
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling…