Guide for creating DAAF agent definition files. Covers 12-section template, hook registration, skills-in-frontmatter, integration checklist. Use when adding or revising agents. For SKILL.md files, use skill-authoring instead.
中文简介正在准备中。当前显示原文说明。
R visualization with ggplot2 grammar of graphics. Geoms, aesthetics, scales, facets, coords, themes. Extensions: patchwork, ggrepel, ggridges, ggdist. Use when execution language is R. Python equivalent: plotnine.
中文简介正在准备中。当前显示原文说明。
实测评分 未实测
查看安装方法安装前可以查看交给 AI 代理的指令内容。
R visualization with the grammar of graphics via ggplot2 4.0.x. Covers geoms (point, line, bar, histogram, boxplot, violin, ribbon, tile, text), aesthetics, scales, coordinates, facets, and themes. Extension packages: patchwork (multi-panel composition), ggrepel (non-overlapping text labels), ggridges (ridgeline density plots), ggdist (distribution visualization). Use when execution language is R and static publication-quality figures are needed. Python equivalent: plotnine (which ports ggplot2's grammar to Python). For interactive R charts, use plotly-r instead.
ggplot2 is the grammar of graphics implementation for R:
+ggplot2 4.0.0 is a major release with significant breaking changes. Code written for 3.x may need updates.
linewidth vs size for LinesThe size aesthetic for line-based geoms was deprecated in 3.4.0. In 4.0.x:
geom_line(size = 1) still works but throws a deprecation warninggeom_bar(size = 1) / geom_col(size = 1) silently ignores size (fallback removed)linewidth for lines, borders, and outlinessize remains correct for points only (geom_point(size = 3))# WRONG (deprecated / ignored in 4.0)
geom_line(size = 1)
geom_bar(size = 0.5)
# CORRECT (4.0+)
geom_line(linewidth = 1)
geom_bar(linewidth = 0.5)
| Change | 3.x Behavior | 4.0.x Behavior |
|---|---|---|
| S7 internals | S3 classes | S7 classes (affects extension authors, not users) |
coord_trans() | Primary name | Renamed to coord_transform(); coord_trans() still works |
theme_set() etc. | Primary names | Renamed: set_theme(), get_theme(), update_theme(), replace_theme(); old names still work |
geom_errorbarh() | Primary | Deprecated; use geom_errorbar(orientation = "y") |
geom_violin(draw_quantiles) | Geom parameter | Deprecated; use geom_violin(quantiles = c(...), quantile.linetype = 1) — quantiles are hidden by default in 4.0, so quantile.linetype (a non-0 value) is required to display them |
fatten argument | In boxplot/crossbar/pointrange | Deprecated |
borders() | Active | Deprecated; use annotation_borders() |
| Pre-3.0 deprecations | Warnings | Now errors |
| Theme geom defaults | Via update_geom_defaults() | New theme(geom = element_geom(...)) for global defaults |
| Binning defaults | Old boundary selection | Better adherence to nbin argument; may change existing plots |
mgcv, tibble | Imported | Moved to Suggests upstream; both pre-installed in DAAF (no action needed) |
theme(geom = element_geom(...)) for global geom aesthetic defaultsfrom_theme() inside aes() to reference theme defaultsstat_connect() and stat_manual() new statstheme(panel.widths, panel.heights) for panel sizinglabs(dictionary = ...) for label mapping by variable nameggsave() can write multi-page PDFs from a list of plotstheme_*(ink, paper, accent) arguments for foreground/background/highlight colors| File | Purpose | When to Read |
|---|---|---|
quickstart.md | Basic ggplot pattern, ggsave, essential setup | Starting out or quick reminder |
geoms.md | All major geoms with examples | Choosing chart types |
scales.md | Scales, axes, color palettes, labels, the scales package | Axis/color/label formatting |
facets.md | facet_wrap, facet_grid, labellers, spacing | Multi-panel layouts |
themes.md | Built-in themes, custom theme(), publication-ready styling | Styling and polish |
extensions.md | patchwork, ggrepel, ggridges, ggdist | Multi-panel, labels, distributions |
gotchas.md | 4.0 migration, common mistakes, factor ordering, save tips | Debugging or reviewing |
quickstart.mdgeoms.mdscales.mdfacets.mdthemes.mdextensions.mdgotchas.md| Skill | Relationship |
|---|---|
plotnine | Python equivalent (plotnine ports ggplot2 to Python) |
tidyverse | Data preparation -- tidy data feeds into ggplot2 pipelines |
plotly-r | Interactive R charts (use when interactivity needed) |
gt | Publication-quality tables (use for tabular output, not charts) |
r-python-translation | Cross-language visualization translation |
data-scientist | Method selection and visualization design guidance |
What are you visualizing?
├─ Relationship (x vs y)
│ ├─ Continuous x, continuous y → geom_point() + geom_smooth()
│ ├─ Time series → geom_line()
│ └─ With error/uncertainty → geom_pointrange() or geom_ribbon()
├─ Distribution
│ ├─ One variable → geom_histogram() or geom_density()
│ ├─ By group (few groups) → geom_boxplot() or geom_violin()
│ ├─ By group (many groups) → ggridges::geom_density_ridges()
│ └─ Full distribution detail → ggdist::stat_halfeye()
├─ Comparison
│ ├─ Counts → geom_bar()
│ ├─ Values → geom_col()
│ └─ Grouped → geom_col(position = "dodge")
├─ Composition
│ ├─ Parts of whole → geom_col(position = "fill")
│ └─ Over time → geom_area(position = "stack")
├─ Heatmap / tile → geom_tile() or geom_raster()
└─ Multiple plots → patchwork (p1 + p2) / p3
Saving a plot?
├─ To PNG (default for DAAF) → ggsave("file.png", p, width = 10, height = 8, dpi = 300)
├─ To PDF → ggsave("file.pdf", p, width = 10, height = 8)
├─ To SVG → ggsave("file.svg", p, width = 10, height = 8)
├─ Multiple plots to one PDF → ggsave("file.pdf", list(p1, p2, p3))
└─ Temp file (smoke tests) → ggsave(tempfile(fileext = ".png"), p)
In DAAF research pipelines, 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}.Rbash {BASE_DIR}/scripts/run_with_capture.sh {script_path}ggsave() to save plots to the project output directorySee agent_reference/SCRIPT_EXECUTION_REFERENCE.md for the mandatory file-first
execution protocol.
library(ggplot2)
library(scales) # label_comma(), label_percent(), etc.
library(patchwork) # plot composition: p1 + p2, p1 / p2
library(ggrepel) # geom_text_repel(), geom_label_repel()
library(ggridges) # geom_density_ridges()
library(ggdist) # stat_halfeye(), stat_dots()
p <- ggplot(df, aes(x = col_x, y = col_y)) +
geom_point() +
labs(title = "Title", x = "X Label", y = "Y Label") +
theme_minimal()
ggsave("output.png", p, width = 10, height = 8, dpi = 300)
| Geom | Use Case |
|---|---|
geom_point() | Scatter plots |
geom_line() | Line plots / time series |
geom_bar() | Count bars (stat = "count") |
geom_col() | Value bars (stat = "identity") |
geom_histogram() | Distributions |
geom_density() | Density curves |
geom_boxplot() | Box-and-whisker |
geom_violin() | Violin plots |
geom_smooth() | Trend lines |
geom_tile() | Heatmaps |
| Aesthetic | Controls | Use size or linewidth? |
|---|---|---|
x, y | Position | N/A |
color | Point/line color | N/A |
fill | Area fill color | N/A |
size | Point size only (4.0+) | size for points |
linewidth | Line width (4.0+) | linewidth for lines |
shape | Point shape | N/A |
alpha | Transparency | N/A |
linetype | Line pattern | N/A |
| Topic | Reference File |
|---|---|
| Basic plot pattern | ./references/quickstart.md |
| ggsave() parameters | ./references/quickstart.md |
| Data requirements | ./references/quickstart.md |
| Scatter, line, bar, area | ./references/geoms.md |
| Histogram, density, boxplot | ./references/geoms.md |
| Smoothing, error bars | ./references/geoms.md |
| Heatmaps, tiles, text | ./references/geoms.md |
| Position adjustments | ./references/geoms.md |
| Continuous/discrete scales | ./references/scales.md |
| Color palettes (Brewer, viridis) | ./references/scales.md |
| Axis labels and formatting | ./references/scales.md |
| scales package helpers | ./references/scales.md |
| facet_wrap, facet_grid | ./references/facets.md |
| Free scales, labellers | ./references/facets.md |
| Built-in themes | ./references/themes.md |
| Custom theme() elements | ./references/themes.md |
| Publication-ready themes | ./references/themes.md |
| patchwork composition | ./references/extensions.md |
| ggrepel labels | ./references/extensions.md |
| ggridges ridgeline plots | ./references/extensions.md |
| ggdist distribution viz | ./references/extensions.md |
| linewidth vs size migration | ./references/gotchas.md |
| 4.0 breaking changes | ./references/gotchas.md |
| Factor ordering | ./references/gotchas.md |
| Save resolution/dimensions | ./references/gotchas.md |
| Common errors | ./references/gotchas.md |
When ggplot2 is used as a primary visualization tool, include in the report's Software & Tools references:
Wickham, H. (2016). ggplot2: Elegant Graphics for Data Analysis (2nd ed.). Springer-Verlag New York. https://ggplot2.tidyverse.org
Cite when: ggplot2 produces figures included in the report. Do not cite when: Only used for quick exploratory plots not included in deliverables.
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Guide for creating DAAF agent definition files. Covers 12-section template, hook registration, skills-in-frontmatter, integration checklist. Use when adding or revising agents. For SKILL.md files, use skill-authoring instead.
中文简介正在准备中。当前显示原文说明。
Researcher-facing analytic triangulation ("creative verification") for stress-testing provisional findings and designing pre-specified challenges before an analysis runs. Turns a researcher's concern or focal claim into competing explanations, bounded discriminating tests, audited diagnostic artifacts, and evidence-calibrated interpretations in a hypothesis/evidence ledger — behavioral, output-level verification replacing line-by-line code review. Covers 12 challenge families organized by Shadish-Cook-Campbell validity type, named sensitivity statistics, pre-committed interpretation rules, anti-fishing guardrails, and interactive diagnostic-artifact QA. Use in Ad Hoc Collaboration to verify, challenge, or stress-test a result, or to design discriminating tests before an analysis runs. Not code-change verification (verify skill / code review) and not final adjudication or re-execution (data-verifier, Reproducibility Verification) — prospective, hypothesis-driven challenge design of analytic claims.
中文简介正在准备中。当前显示原文说明。
In-situ smoke testing that verifies a LIVE DAAF deployment functions end-to-end in whatever provider route it is configured for. Auto-detects the active install route (anthropic-subscription, openrouter, chatgpt-subscription shim, openai-api shim) and runs tiered probes: Tier 0 free preflight (route/env coherence, hooks, statuslines, shim health); Tier 1 one live round-trip (~cents); Tier 2 a six-probe functional battery (dispatch, coding, web, skill loading, isolation-strip, nested-dispatch deny); Tier D a zero-cost deterministic battery (bats, Pester, lint, safety-hook tests). Use after install, after a rebuild or update, after any provider/config change (new API key, model remap, shim change), for pre-release validation, or when asked "is my install working" or to "smoke test the deployment/config." Requires the DAAF_DEV=1 dev image; a contributor tool, not end-user-facing. NOT DAAFBench (model behavioral-adherence evaluation under benchmarks/) and NOT scripts/smoke_tests/ (R/Python library-package smoke tests).
中文简介正在准备中。当前显示原文说明。
Operational framework for the DAAF orchestrator. Defines engagement modes, confirmation protocol, subagent dispatch, context budget, and reference-loading. Loaded exclusively by the orchestrator — not for subagents or user questions.
中文简介正在准备中。当前显示原文说明。
Data science methodology and method-selection routing for quantitative research. Covers EDA, data validation, descriptive analysis, causal inference (IV, DiD, RD, synthetic control), clustering/PCA/UMAP, supervised ML, geospatial analysis, network analysis, and visualization design. Contains the canonical method-to-library routing tree, routed by execution language — Python: statsmodels (OLS/GLM/time series), pyfixest (FE/DiD), linearmodels (RE/GMM/SUR), svy (complex surveys), scikit-learn (clustering/prediction ML), geopandas (spatial), igraph (network analysis); R: r-stats (OLS/GLM/time series), fixest (FE/DiD), plm (panel/RE/IV), survey-r (complex surveys), tidymodels (ML), sf-terra (spatial), igraph-r (network analysis). Load the routed tool-specific skill before giving tool-specific advice or writing code — library skills encode environment constraints and curated caveats absent from general knowledge.
中文简介正在准备中。当前显示原文说明。
Interpretation guidance for Urban Institute Education Data Portal datasets. The Portal is a curation layer over federal data: lowercase variable names, integer-encoded categoricals, standardized missing codes (-1 missing, -2 not applicable, -3 suppressed). Covers year definitions, grade encoding (grade=-1 is Pre-K, not missing), suppression rates, ODC-By licensing, and cross-source join identifiers. Load before analyzing any Portal data. Routes to source-specific deep-dive skills for individual datasets.
中文简介正在准备中。当前显示原文说明。