grammar-of-graphics-and-declarative-visualization

Build declarative data visualizations with Vega-Lite, Vega, and Observable Plot.

5.3k|765|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/openai/plugins --skill grammar-of-graphics-and-declarative-visualization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: grammar-of-graphics-and-declarative-visualization
Source: https://github.com/openai/plugins/tree/main/plugins/build-web-data-visualization/skills/grammar-of-graphics-and-declarative-visualization
Command: npx skills add https://github.com/openai/plugins --skill grammar-of-graphics-and-declarative-visualization

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Choosing and authoring the right chart implementation for tabular data is slow and error-prone when developers jump straight to bespoke rendering code. This Skill provides a grammar-of-graphics decision path so charts are expressed as data plus marks, encodings, and transforms using declarative tools.

Core Features & Use Cases

  • Tool Selection Guidance: Routes between Observable Plot, Vega-Lite, and Vega based on portability, composition, and control needs.
  • Declarative Chart Authoring: Produces readable, embeddable specs with marks, encodings, transforms, faceting, and interactions.
  • Boundary Detection: Identifies when a declarative spec has become strained and D3, Canvas, or WebGL should take over.
  • Use Case: A developer needs a layered, faceted chart with tooltips for a web dashboard; the Skill recommends Vega-Lite, structures the spec, and flags mobile responsive and instance-count considerations.

Quick Start

Ask the assistant to write a Vega-Lite spec for your dataset and explain whether Plot, Vega-Lite, or D3 is the right fit for the chart.

Frequently Asked Questions about grammar-of-graphics-and-declarative-visualization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between Observable Plot, Vega-Lite, and D3?

Use Observable Plot for concise exploratory charts in JavaScript, Vega-Lite for portable declarative specs with transforms and faceting, and D3 only when the chart needs bespoke layout or rendering control that a grammar cannot express cleanly.

How do I write a Vega-Lite spec for a dataset?

Normalize the table shape, then name the mark, encodings, transforms, faceting, and interaction model explicitly. Keep the spec readable and portable so it can be embedded, validated, or translated across stacks.

When should I stop using Vega-Lite and switch to D3 or WebGL?

Switch when the spec becomes harder to read than custom code, or when you need GPU-scale marks, particles, custom shaders, true 3D, or high-volume geospatial layers. Declarative grammars fit while the chart stays expressible as data plus marks plus encodings.

Does Vega-Lite support mobile responsive charts?

Vega-Lite supports responsive specs, but you must plan label and tick reduction, hover replacement for touch, and touch target sizing. Check whether the grammar keeps the main visualization visible around controls in portrait and landscape.

What are the limitations of declarative chart grammars?

Declarative grammars struggle with bespoke layout, extreme density, GPU-scale rendering, and interactions the grammar cannot express. Forcing such charts into a spec produces opaque, brittle output that is harder to maintain than custom rendering code.