scientific-visualization – skill Dữ liệu & Khoa học cho agent AI
Tạo và kiểm tra hình ảnh khoa học chính xác, dễ tiếp cận và đạt chuẩn xuất bản bằng Matplotlib, Seaborn hoặc Plotly. Dùng cho thiết kế hình, bố cục nhiều khung, hiển thị độ bất định và dữ liệu thiếu, kiểm tra màu sắc/độ tương phản, xác thực metadata hình ảnh và lập kế hoạch xuất cho tạp chí.
Cài skill scientific-visualization bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/scientific-visualization-99aa2.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /scientific-visualization – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/scientific-visualization-99aa2.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $scientific-visualization – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/scientific-visualization-99aa2.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /scientific-visualization – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/scientific-visualization-99aa2.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /scientific-visualization – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Scientific Visualization
Build figures that preserve scientific meaning before optimizing appearance. Separate universal principles from dated publisher rules, preserve raw data and transformations, use color redundantly, and inspect delivered files rather than trusting plotting defaults.
Non-negotiable guardrails
- Never alter, hide, invent, or selectively enhance data to improve a figure.
- Preserve raw tables/images, exclusions, missing-value codes, analysis code, normalization, binning, image adjustments, and random seeds.
- Do not infer journal requirements. Identify the exact journal, article type, figure type, and submission phase; verify its live official guidance.
- Do not claim that a palette, DPI value, format, or automated report makes a figure accessible or journal-compliant.
- Do not silently connect missing observations, suppress inconvenient points, upsample images as if detail increased, or tune axes/dual axes to exaggerate a conclusion.
- Keep interactive and static outputs as distinct deliverables. Interactive hover is not a substitute for labels, alt text, keyboard access, an accessible data table, or a static fallback.
Read references/publication_guidelines.md for deceptive-encoding and integrity checks. Read references/journal_requirements.md only after the target and phase are known.
Workflow
1. Define the evidence and destination
Record:
- audience and medium: manuscript, web, slide, poster, supplement;
- exact publisher/journal, article type, submission phase, and intended final width;
- variable semantics, units, sample/replicate structure, missing/censored values;
- estimator and uncertainty definition;
- transformations: filtering, aggregation, normalization, smoothing, bins, image processing;
- source-data paths/identifiers and output provenance.
If requirements are not known, create a provisional general figure and label all publisher choices as pending verification.
2. Choose an honest encoding
Prefer position on a common scale. Before coding, check:
- Bars/areas: normally include zero because length/area is measured from a baseline.
- Points/lines: nonzero limits can be valid; show context and disclose breaks.
- Uncertainty: name SD, SE, CI, percentile, posterior, or another interval; state
nand the unit of replication. - Raw observations: show them when feasible; do not let jitter obscure categories/values.
- Missing data: distinguish missing, zero, censored, and excluded; use gaps or explicit model/interpolation styling.
- Area/volume: scale area/volume, not radius/diameter; avoid decorative 3D.
- Log axes: label the base/transform and declare how zero/negative values are handled.
- Binning/smoothing: record edges, bandwidth/window, method, and sensitivity.
- Normalization: state formula/reference and keep limits consistent across compared panels.
- Dual axes: prefer aligned panels; if unavoidable, justify units and do not engineer apparent correlation.
- Images: preserve originals, disclose whole-image adjustments, show scale bars, and avoid clipped/erased background.
3. Design accessibility in, not after
- Use color plus marker, line style, hatching, direct label, or panel separation.
- Choose qualitative, sequential, diverging, or cyclic color according to data semantics.
- Audit foreground/background contrast at the rendered size.
- Make missing and out-of-range values explicit.
- Provide alt text, a longer description for complex figures, and underlying data for web delivery.
- Treat WCAG 2.2 as web guidance: 4.5:1 normal text, 3:1 large text, and 3:1 for graphical objects required for understanding; color cannot be the only cue. Applicability and exceptions matter.
See references/color_palettes.md. A grayscale screen is useful but is not a complete color-vision or accessibility test.
4. Implement with scoped styles
Run shell examples from this skill directory. For your own figure script, add scripts/ and assets/ to the import path (see the bootstrap in references/matplotlib_examples.md) and create the output directory. Use Matplotlib's object-oriented API and temporary style contexts:
import matplotlib.pyplot as plt
from style_presets import style_context
with style_context("default", palette_name="okabe_ito_on_white"):
fig, ax = plt.subplots(
figsize=(89 / 25.4, 60 / 25.4),
layout="constrained",
)
ax.plot(x, y, marker="o", label="Observed")
ax.set(xlabel="Time (hours)", ylabel="Response (unit)")
ax.legend()layout="constrained" supports colorbars, nested GridSpec, subfigures, and subplot_mosaic. Do not call tight_layout() afterward; it disables constrained layout.
For exact physical dimensions, do not use bbox_inches="tight" unless the changed page size is intentional.
Color normalization
import matplotlib as mpl
norm = mpl.colors.TwoSlopeNorm(vmin=-2, vcenter=0, vmax=5)
cmap = mpl.colormaps["RdBu_r"].with_extremes(bad="#777777")
image = ax.imshow(values, norm=norm, cmap=cmap, interpolation="nearest")
fig.colorbar(image, ax=ax, label="Change (unit)")Use LogNorm, CenteredNorm, SymLogNorm, BoundaryNorm, or TwoSlopeNorm only when its mapping matches the scientific meaning.
Seaborn
Seaborn 0.13.2 uses the current errorbar API:
sns.lineplot(
data=frame,
x="time",
y="response",
hue="treatment",
style="treatment",
markers=True,
errorbar=("ci", 95),
n_boot=5000,
seed=20260723,
ax=ax,
)For repeated measurements, preserve the subject/sample identifier. To show individual trajectories, use Seaborn's units with estimator=None; this draws one line per sampling unit instead of an aggregate mean. For an aggregate uncertainty band, compute intervals using the actual independent sampling unit (for example, a subject-level bootstrap) and plot those intervals explicitly. A row-wise CI and a fixed random seed do not account for within-subject dependence. See the [relational tutorial](https://seaborn.pydata.org/tutorial/relational).
Seaborn drops missing rows before drawing lines, so it can bridge a missing observation. For visible gaps, use explicit NaNs/masks with Matplotlib or draw contiguous observed segments separately.
Axes-level functions fit custom Matplotlib layouts; figure-level functions create their own figures/facets. Do not customize Seaborn's internal artist lists as if they were stable API.
Plotly
- Use
write_html()for interaction andwrite_image()/plotly.io.write_images()for static output. - Kaleido 1.4.0 requires Chrome/Chromium; it no longer bundles Chrome. Plotly 7 requires MathJax 3/4, not 2.
- Current static formats: PNG, JPEG, WebP, SVG, PDF. EPS is Kaleido v0-only.
- Plotly 7 removes
engine=, Orca, Kaleido <1, andplotly.io.kaleido.scope; useplotly.io.defaults. width,height, andscalecontrol pixels;scale=3is not inherently “300 DPI.”- WebGL traces embed raster content in PDF/SVG. Plotly Express may select WebGL above 1,000 rows; use
render_mode="svg"when vector markers are required. - Fully offline exports need local external assets when a figure references MathJax/topojson/tiles.
5. Export explicitly and record provenance
from figure_export import export_figure
report = export_figure(
fig,
"outputs/figure1",
formats=["pdf", "png"],
dpi=600,
bbox_inches=None, # preserve figure page dimensions
provenance={
"raw_data": "data/source.csv",
"transformations": ["predeclared QC filter", "group mean"],
"uncertainty": "95% bootstrap CI; seed 20260723",
"missing_data": "retained as gaps",
},
write_manifest=True,
)The exporter refuses implicit overwrite and publishes each file atomically (a multi-format batch is not a transaction). It preserves vector DPI for embedded rasters and uses TIFF LZW. Matplotlib normally writes RGBA TIFF even on white; request tiff_rgb=True for an RGB TIFF without alpha. This verifies opacity before removing the alpha channel. It does not validate scientific content or publisher acceptance.
For editable fonts:
- PDF/PS Type 42 embeds TrueType fonts.
svg.fonttype="none"keeps text editable/searchable but does not embed fonts; appearance depends on installed fonts.svg.fonttype="path"preserves glyph appearance as paths but loses editable/searchable text.
Use an opaque explicit background unless transparency is required; blending against another background changes apparent contrast.
6. Inspect, compare, and review
1. Inspect file metadata.
2. Audit palette contrast/grayscale separation.
3. Compare against a dated publisher snapshot.
4. View at final size in the manuscript/web context.
5. Manually review fonts, embedded rasters, clipping, legends, scale bars, image integrity, caption, alt text, and source data.
6. Re-check the live target-journal page immediately b
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- database-migrations-sql-migrations – Migration cơ sở dữ liệu SQL với chiến lược zero-downtime cho PostgreSQL, MySQL và SQL…
- database-optimizer – Chuyên gia tối ưu cơ sở dữ liệu, chuyên về tinh chỉnh hiệu năng hiện đại, tối ưu truy…
- scientific-writing – Soạn thảo, chỉnh sửa và kiểm tra bản thảo hoặc báo cáo khoa học với nguồn gốc bằng chứng…
- dbt-transformation-patterns – Các mẫu sản xuất cho dbt (data build tool) bao gồm tổ chức model, chiến lược kiểm thử…
- serving-llms-vllm – vLLM: phục vụ LLM thông lượng cao, OpenAI API, lượng tử hóa.
- scikit-bio – Bộ công cụ dữ liệu sinh học. Phân tích trình tự, căn chỉnh, cây phát sinh loài, chỉ số…
- spark-environment-setup – Thiết lập môi trường huấn luyện/suy luận ML hoạt động trên NVIDIA DGX Spark (GB10…
- scikit-learn – Hỗ trợ học máy trong Python với scikit-learn. Áp dụng khi làm việc với học có giám sát…