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.
中文简介正在准备中。当前显示原文说明。
Interactive R visualization with plotly: plot_ly() for scatter, line, bar, heatmap, 3D charts; ggplotly() to convert ggplot2 objects; layout() for customization; htmlwidgets::saveWidget() for export. Use when execution language is R and interactivity needed. Python equivalent: plotly. For static figures use ggplot2.
中文简介正在准备中。当前显示原文说明。
实测评分 未实测
查看安装方法安装前可以查看交给 AI 代理的指令内容。
Interactive R visualization with the plotly package (4.12.0). Covers plot_ly() for direct trace-based charts (scatter, line, bar, histogram, box, heatmap, 3D scatter, 3D surface); ggplotly() for converting ggplot2 objects to interactive equivalents; layout() for axis, title, legend, and annotation customization; subplot() for multi-panel composition; and htmlwidgets::saveWidget() for self-contained HTML export. Use when execution language is R and interactive hover/zoom/pan behavior is needed. Python equivalent: plotly (Plotly Express + Graph Objects). For static publication-quality R figures, use ggplot2 instead.
plotly is an R interface to the Plotly.js JavaScript library:
|> for chained layout/trace updates| File | Purpose | When to Read |
|---|---|---|
quickstart.md | plot_ly() basics, add_trace(), piping, saveWidget | Starting out |
chart-types.md | scatter, line, bar, histogram, box, heatmap, 3D | Choosing chart types |
ggplotly.md | Converting ggplot2 objects, tooltip customization | ggplot2 bridge |
layouts.md | layout() for axes, titles, legends, annotations | Customizing appearance |
export.md | saveWidget(), orca/kaleido for static, Quarto embedding | Saving and sharing |
subplots.md | subplot() composition, shared axes, mixed types | Multi-panel layouts |
gotchas.md | plot_ly vs ggplotly tradeoffs, formula interface, performance | Debugging |
quickstart.mdchart-types.mdggplotly.mdlayouts.mdexport.mdsubplots.mdgotchas.md| Skill | Relationship |
|---|---|
plotly | Python equivalent (Plotly Express + Graph Objects) |
ggplot2 | Static R figures; ggplotly() converts ggplot2 objects to interactive |
quarto | Quarto embedding for plotly htmlwidgets |
tidyverse | Data preparation -- tidy data feeds into plot_ly() pipelines |
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 -> plot_ly(type = "scatter", mode = "markers")
| |-- Time series -> plot_ly(type = "scatter", mode = "lines")
| +-- With error/uncertainty -> add error bars via error_y
|-- Distribution
| |-- One variable -> plot_ly(type = "histogram")
| |-- By group -> plot_ly(type = "box") or plot_ly(type = "violin")
| +-- Heatmap/density -> plot_ly(type = "heatmap")
|-- Comparison
| |-- Counts/values -> plot_ly(type = "bar")
| +-- Grouped -> barmode = "group" in layout()
|-- 3D
| |-- Scatter -> plot_ly(type = "scatter3d")
| +-- Surface -> plot_ly(type = "surface")
+-- Already have ggplot2 code -> ggplotly(p)
Saving a plot?
|-- Interactive HTML (primary DAAF export) -> htmlwidgets::saveWidget()
|-- Static PNG (requires orca/kaleido) -> orca() or kaleido()
|-- Embed in Quarto -> just print the widget in a code chunk
+-- Temp file (smoke tests) -> saveWidget(p, tempfile(fileext = ".html"))
Which approach?
|-- Building from scratch -> plot_ly()
|-- Already have ggplot2 code -> ggplotly()
|-- Need fine-grained trace control -> plot_ly()
|-- Quick interactive version of static plot -> ggplotly()
|-- Complex multi-trace with mixed types -> plot_ly() + add_trace()
+-- Want ggplot2 facets interactive -> ggplotly() (preserves faceting)
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}htmlwidgets::saveWidget() to save interactive HTML to the project output directorySee agent_reference/SCRIPT_EXECUTION_REFERENCE.md for the mandatory file-first
execution protocol.
library(plotly)
library(htmlwidgets) # saveWidget() for HTML export
p <- plot_ly(df, x = ~col_x, y = ~col_y, type = "scatter", mode = "markers")
p
Note the formula interface: columns are referenced with ~col_name (tilde
prefix), not bare names or strings.
library(ggplot2)
library(plotly)
g <- ggplot(mtcars, aes(x = wt, y = mpg, color = factor(cyl))) +
geom_point()
p <- ggplotly(g)
p
| Type | Mode | Use Case |
|---|---|---|
"scatter" | "markers" | Scatter plot |
"scatter" | "lines" | Line chart |
"scatter" | "lines+markers" | Line with points |
"bar" | — | Bar chart |
"histogram" | — | Histogram |
"box" | — | Box plot |
"heatmap" | — | Heatmap |
"scatter3d" | "markers" | 3D scatter |
"surface" | — | 3D surface |
p <- plot_ly(df, x = ~x, y = ~y, type = "scatter", mode = "markers") |>
layout(
title = "My Plot",
xaxis = list(title = "X Label"),
yaxis = list(title = "Y Label")
)
library(htmlwidgets)
# HTML export (uses CDN for plotly.js -- default for DAAF)
saveWidget(p, "plot.html", selfcontained = FALSE)
# Self-contained HTML (embeds plotly.js, ~3MB -- requires pandoc)
# saveWidget(p, "plot.html", selfcontained = TRUE) # NOT available in DAAF (no pandoc)
DAAF note:
selfcontained = TRUErequires pandoc, which is not installed in the DAAF container. Useselfcontained = FALSE(loads plotly.js from CDN). Static image export viaorca()orkaleido()is also not available. Use ggplot2 withggsave()for static PNG/SVG figures.
plotly R functions return the plot object, enabling piping:
p <- plot_ly(df, x = ~x, y = ~y, type = "scatter", mode = "markers") |>
add_trace(y = ~y2, name = "Series 2", mode = "lines") |>
layout(title = "Two Series", xaxis = list(title = "X")) |>
config(displayModeBar = FALSE)
| Topic | Reference File |
|---|---|
| plot_ly() basics | ./references/quickstart.md |
| add_trace() | ./references/quickstart.md |
| Formula interface (~x) | ./references/quickstart.md |
| Piping with |> | ./references/quickstart.md |
| saveWidget() | ./references/quickstart.md |
| Scatter plots | ./references/chart-types.md |
| Line charts | ./references/chart-types.md |
| Bar charts | ./references/chart-types.md |
| Histograms | ./references/chart-types.md |
| Box plots | ./references/chart-types.md |
| Heatmaps | ./references/chart-types.md |
| 3D scatter and surface | ./references/chart-types.md |
| ggplotly() conversion | ./references/ggplotly.md |
| Tooltip customization | ./references/ggplotly.md |
| ggplotly limitations | ./references/ggplotly.md |
| Axis titles and formatting | ./references/layouts.md |
| Legends | ./references/layouts.md |
| Annotations | ./references/layouts.md |
| Multiple axes | ./references/layouts.md |
| Color scales | ./references/layouts.md |
| HTML export | ./references/export.md |
| Static image export | ./references/export.md |
| Quarto embedding | ./references/export.md |
| subplot() composition | ./references/subplots.md |
| Shared axes in subplots | ./references/subplots.md |
| Mixed chart types | ./references/subplots.md |
| plot_ly vs ggplotly | ./references/gotchas.md |
| Formula interface gotchas | ./references/gotchas.md |
| Performance with large data | ./references/gotchas.md |
| Common errors | ./references/gotchas.md |
When plotly is used as a primary visualization tool, include in the report's Software & Tools references:
Sievert, C. (2020). Interactive Web-Based Data Visualization with R, plotly, and shiny. Chapman and Hall/CRC. https://plotly-r.com
Cite when: plotly produces interactive figures included in the report or notebook. 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.
中文简介正在准备中。当前显示原文说明。