AGENT SKILL

interactive-science-plots

Building interactive scientific visualizations — Plotly/Bokeh dashboards, linked views, and exploratory data apps.

License 许可
MIT
所属仓库
TanNhatCMS/jarvis
最近更新
2026-11-07
Stars
★ 0
Forks
1

01 前言 Front Matter

name
interactive-science-plots
category
scientific
description
Building interactive scientific visualizations — Plotly/Bokeh dashboards, linked views, and exploratory data apps.

03 SKILL.md 正文

Overview

Static figures present conclusions; interactive plots enable exploration — zooming into regions, hovering for values, toggling series, brushing linked views. This skill covers building interactive scientific visualizations with Plotly and Bokeh (plus lightweight dashboarding), designing interactions that answer real questions, and the performance and reproducibility practices interactive work demands.

When to use

  • Exploring a large or high-dimensional dataset before committing to static figures
  • Sharing results with collaborators who need to interrogate the data themselves
  • Building a dashboard for monitoring experiments, instruments, or model runs
  • Presenting complex data (spectra, maps, time series) in talks or supplements
  • Deciding what deserves interactivity vs what should stay a static figure

Core concepts

  • Interaction vocabulary: hover (inspect values), zoom/pan (focus), brush/select (subset), toggle (compare series), linked views (selection in one plot highlights in others) — each serves a question; gratuitous widgets are clutter.

  • The exploration–explanation split: interactive tools are for exploration and collaborator interrogation; papers still need static figures — design the interactive view to support the same conclusions, not to replace the argument.

  • Data volume vs browser: browsers choke beyond ~10⁵–10⁶ points — downsample (datashader), aggregate, or use WebGL traces; never ship a 50 MB HTML file.

  • State and reproducibility: an interactive session's conclusions should be capturable — exportable selections, URL parameters, or logged filter states — otherwise findings evaporate when the tab closes.

  • Linked views: the most powerful pattern — brushing a region in a scatter plot highlights corresponding rows in a table, map, and time series; implement with shared data sources (Bokeh ColumnDataSource, Plotly selections).

  • Progressive disclosure: overview first, zoom/filter, details on demand (Shneiderman's mantra) — don't dump all dimensions at once.

  • Brushing and linking: selecting in one view highlights the same records in all others — the core interaction for multidimensional data; implement with shared data sources, not duplicated state.

  • Level of detail: show aggregates at overview zoom, individual points on zoom-in — datashader-style dynamic rendering keeps million-point datasets explorable without browser meltdown.

  • Provenance of interactions: log the filter/selection state that produced an insight (URL parameters, exported subsets) — otherwise discoveries made by dragging sliders evaporate when the tab closes.

Practical workflow

1. Choose the stack

import plotly.express as px
# Plotly: fastest path to rich interactivity, exports to self-contained HTML
fig = px.scatter(df, x="x", y="y", color="group", hover_data=["id", "value"],
                 marginal_x="histogram")
fig.write_html("explore.html", include_plotlyjs="cdn")
  1. Plotly: best default — expressive, good docs, self-contained HTML export; Plotly Express for speed, graph_objects for control.
  2. Bokeh: better for streaming data and custom linked dashboards; steeper learning curve.
  3. Panel/Streamlit/Dash: when you need a real app (controls, layouts, callbacks) rather than a plot — Streamlit for fastest prototyping, Dash for production.
  4. Datashader + HoloViews: for genuinely big data (10⁷+ points) — rasterize server-side, interact client-side.

2. Design the interactions

  1. Start from questions: "which points are outliers?", "how does this region behave over time?", "do groups separate?" — one interaction per question.
  2. Implement linked views for multidimensional data: select in the scatter, see the spectra/map/time series update.
  3. Add hover templates with the identifiers and values a scientist actually needs (sample ID, coordinates, uncertainty) — default hovers waste the opportunity.

3. Handle scale

  1. Downsample intelligently for display (stratified or density-preserving), but keep full data behind selections where feasible.
  2. Use WebGL rendering (scattergl) for 10⁴–10⁶ points; datashader beyond that.
  3. Lazy-load: don't embed multi-MB datasets in HTML when a data server (or parquet + range queries) will do.

4. Share and preserve

  1. Export self-contained HTML for collaborators (note the Plotly.js CDN vs inline trade-off: inline works offline, CDN keeps files small).
  2. For dashboards: pin dependency versions, document the data source and refresh logic — a dashboard showing stale data silently is worse than none.
  3. Capture conclusions: "export selection" buttons, snapshot URLs, or companion notebooks that regenerate the key static figures from the same data.

5. Build a linked-view explorer

  1. Choose 2–4 complementary views (scatter, histogram, map, time series) sharing one data source — each view answers a different question about the same records.
  2. Implement cross-filtering: brushing the scatter filters the histogram and highlights map points — test that selections propagate in all directions.
  3. Add an "export selection" button writing the current subset to CSV with the filter parameters in the header — this closes the exploration-to-analysis loop.

Common pitfalls

  • Interactivity as a substitute for a conclusion: an explorer that lets users "see for themselves" still needs the author's interpretation stated.
  • Browser meltdown: dumping 10⁷ raw points into a DOM-based plot — downsample or rasterize.
  • Unreproducible exploration: findings discovered by dragging sliders, with no record of the state — log or export the view parameters.
  • Stale dashboards: live-looking dashboards on dead data pipelines — monitor freshness and display the last-update time prominently.
  • Hover-only information: critical values available only on hover are invisible in screenshots and print — keep key numbers in the static layer too.
  • Over-widgeting: twelve dropdowns where two would do — every control must earn its place by answering a real question.
  • Unshared state bugs: views drifting out of sync because each holds its own copy of the data — single source of truth, always.
  • Performance cliff at scale: DOM-based rendering dies past ~10⁵ points — switch to canvas/WebGL or server-side rasterization before users discover the cliff.

04 同仓库更多 Skills

TanNhatCMS
TanNhatCMS/jarvis

web-scrape

Turn web pages into LLM-ready markdown via the Firecrawl API (renders JS, anti-bot handling). Use when browser_open/fetch fails on JS-heavy pages, or when you need clean markdown/structured extraction from a site. Requires FIRECRAWL_API_KEY.

★ 0
TanNhatCMS
TanNhatCMS/jarvis

design-taste-frontend

tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One Page Love, Awwwards Sites of the Day). Deals researched directions (idea, composition, type, palette, photographs, section blueprints) from a library, enforces a strict no-slop house style with a real-browser inspector, and runs a look-and-fix loop on screenshots. Use this whenever you build, design, redesign, restyle, polish or review a landing page, marketing site, portfolio, product page, one-pager, hero or any public-facing web page, in any stack (HTML/CSS, React, Next.js, Vue, Svelte, Astro, Tailwind) — also when the user says a page looks generic, templated, "AI-made", sloppy, or asks to make it look designed, premium, award-level or less like every other site. Not for dashboards or app screens.

★ 0
TanNhatCMS
TanNhatCMS/jarvis

test-driven-development

Use when implementing any feature or bugfix, before writing implementation code

★ 0
TanNhatCMS
TanNhatCMS/jarvis

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

★ 0
TanNhatCMS
TanNhatCMS/jarvis

requesting-code-review

Use when completing tasks, implementing major features, or before merging to verify work meets requirements

★ 0
TanNhatCMS
TanNhatCMS/jarvis

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).

★ 0