skills/17-DAAF-Contribution-Community-daaf/dot-claude/skills/plotnine/SKILL.md
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.
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research plotnineInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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:
scripts/stage8_analysis/{step}_{plot-name}.pyClosely 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:
agent_reference/WORKFLOW_PHASE4_ANALYSIS.md — Stage 8 (Analysis & Visualization)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 included in deliverables.
development
Conduct rigorous thematic analysis (TA) of qualitative data following Braun and Clarke's (2006) six-phase framework. Use whenever the user mentions 'thematic analysis', 'TA', 'Braun and Clarke', 'qualitative coding', 'identifying themes', or asks for help analysing interviews, focus groups, open-ended survey responses, or transcripts to identify patterns. Also trigger for questions about inductive vs theoretical coding, semantic vs latent themes, essentialist vs constructionist epistemology, building a thematic map, or writing up a qualitative findings section. Covers all six phases, the four upfront analytic decisions, the 15-point quality checklist, and the five common pitfalls. Produces a Word document write-up and an annotated thematic map. Does NOT cover IPA, grounded theory, discourse analysis, conversation analysis, or narrative analysis — use a different method for those.
development
Guide users through writing a systematic literature review (SLR) following the PRISMA 2020 framework. Use this skill whenever the user mentions 'systematic review', 'systematic literature review', 'SLR', 'PRISMA', 'PRISMA 2020', 'PRISMA flow diagram', 'PRISMA checklist', or asks for help writing, structuring, or auditing a literature review that follows reporting guidelines. Also trigger when the user asks about inclusion/exclusion criteria for a review, search strategies for databases like Scopus/WoS/PubMed, study selection processes, risk of bias assessment, or narrative synthesis for a review paper. This skill covers the full PRISMA 2020 checklist (27 items), produces a Word document manuscript in strict journal article format, generates an annotated PRISMA flow diagram, and enforces APA 7th Edition referencing throughout. It does NOT cover meta-analysis or statistical pooling. By Chuah Kee Man.
testing
Performs placebo-in-time sensitivity analysis with hierarchical null model and optional Bayesian assurance. Use when checking model robustness, verifying lack of pre-intervention effects, or estimating study power.
data-ai
Fit, summarize, plot, and interpret a chosen CausalPy experiment. Use after the causal method has been selected, including when configuring PyMC/sklearn models and scale-aware custom priors.