Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
brycewang-stanford avatar

Plotnine

  • 1 installs
  • 3.2k repo stars
  • Updated August 4, 2026
  • brycewang-stanford/awesome-agent-skills-for-empirical-research

plotnine is a skill that is a reference for creating static, publication-quality Python figures using the grammar of graphics (ggplot2 syntax).

About

This skill is a reference for creating static, publication-quality figures with plotnine, a Python implementation of the grammar of graphics using ggplot2 syntax. A developer uses it for geoms, aesthetics, scales, coordinates, facets, and themes when static output is needed or coming from an R ggplot2 background. It matters for producing print-ready charts for reports and papers.

  • Static plotnine visualization using ggplot2 grammar-of-graphics syntax
  • Covers geoms, aesthetics, scales, coordinates, facets, and themes
  • Produces publication-quality static figures saved to PNG

Plotnine by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #1,803 of 2,064 Data Science & ML skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

plotnine capabilities & compatibility

Capabilities
data visualization · static charts
Use cases
data analysis
Pricing
Free
From the docs

What plotnine says it does

plotnine static visualization library for Python, implementing the grammar of graphics (ggplot2 syntax).
SKILL.md
Prefer over plotly when static output is needed.
SKILL.md
npx skills add https://github.com/brycewang-stanford/awesome-agent-skills-for-empirical-research --skill plotnine

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
repo stars3.2k
Last updatedAugust 4, 2026
Repositorybrycewang-stanford/awesome-agent-skills-for-empirical-research

What it does

Create static, publication-quality figures with plotnine using ggplot2-style grammar-of-graphics syntax.

Who is it for?

Static publication-quality figures with ggplot2-style syntax for print or reports.

Skip if: Interactive charts (use plotly) or maps (use geopandas).

When should I use this skill?

When creating static publication-quality figures with grammar-of-graphics syntax.

What you get

A static plotnine figure saved as an image for a report.

  • A static plotnine figure saved as an image file

By the numbers

  • 7 common geoms listed
  • 6 reference files

Files

SKILL.mdMarkdownGitHub ↗

Plotnine Skill

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).

What is Plotnine?

plotnine is a data visualization library based on the grammar of graphics:

  • Declarative: Describe what you want, not how to draw it
  • Layered: Build plots by adding components with +
  • ggplot2 compatible: Nearly identical syntax to R's ggplot2
  • Publication-ready: Themes and customization for polished output

How to Use This Skill

Reference File Structure

FilePurposeWhen to Read
quickstart.mdInstallation, imports, basic syntaxStarting out
geoms.mdGeometric objects (points, lines, bars)Choosing chart types
aesthetics.mdMapping data to visual propertiesCustomizing appearance
scales-coords.mdScales, coordinates, positionsAxis/color control
facets-themes.mdMulti-panel plots and stylingLayout and themes
gotchas.mdCommon errors and best practicesDebugging

Quick Decision Trees

"I need to create a plot"

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

"I need to customize appearance"

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

"Something isn't working"

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

File-First Execution in Research Workflows

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:

  • 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.

---

Quick Reference

Basic Plot Pattern

from plotnine import ggplot, aes, geom_point

(
    ggplot(df, aes(x="col_x", y="col_y"))
    + geom_point()
)

Essential Imports

from plotnine import *           # All components
from plotnine.data import mtcars # Built-in datasets

Common Geoms

GeomUse 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

Common Aesthetics

AestheticControls
x, yPosition
colorPoint/line color
fillArea fill color
sizePoint/line size
shapePoint shape
alphaTransparency

Saving Plots

p = ggplot(df, aes("x", "y")) + geom_point()
p.save("plot.png", width=10, height=8, dpi=300)

Topic Index

TopicReference 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

Citation

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.

Related skills

FAQ

When should I use plotnine over plotly?

Prefer plotnine over plotly when static output is needed; use plotly when interactivity is required.

How are plots saved?

Use p.save with width, height, and dpi, for example p.save('plot.png', width=10, height=8, dpi=300).

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.