360 Secure SkillHub
360 安全技能中心

Py Math Viz

核心功能:基于matplotlib、seaborn等库生成符合规范的PNG格式可视化,支持通过JSON规格渲染图表、多图拼接等OpenCV后处理,输出遵循轴标签、无障碍配色、防重叠等质量规则。典型场景:绘制函数、可视化模拟轨迹、模型对比、生成出版级图表或用于笔记/电报的PNG图。输入可为JSON规格或需求描述,输出默认存入out目录。

rokokol
rokokol
热度 46.41
最近更新 2026-05-11 17:37:48
分类:开发依赖:代码执行 / 读写文件应用场景:代码生成 / 数据处理 / 图像生成 / 报告撰写

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add py-math-viz
Metadata
name
py-math-viz
description
Create clear math/data visualizations in Python and export to PNG (matplotlib/seaborn; optional OpenCV post-processing). Use when the user asks to plot functions, draw graphs, visualize simulations/trajectories, compare models, make publication-quality plots, or needs a PNG chart for Telegram/notes. Includes scripts to render plots from a JSON spec and to tile/annotate images.

Py Math Viz

Use Python to produce clean, readable plots and export to PNG by default.

Assumptions (this workspace):

  • Preferred interpreter: /root/.openclaw/workspace/.venv-math/bin/python
  • Libraries: matplotlib, seaborn, numpy (already), opencv-python-headless (installed)

Defaults (quality rules)

  • Output: PNG, dpi>=200, white background
  • Always label axes; add title if it helps
  • Use legend when multiple series exist (and place it so it doesn’t cover data)
  • Avoid overlap:
    • prefer constrained_layout=True and/or plt.tight_layout()
    • rotate dense x-ticks, shorten tick labels
    • increase figure size instead of cramming
  • Use consistent styling:
    • seaborn.set_theme(style="whitegrid")
    • colorblind-friendly palette if unsure

Quick start (script)

Render a plot from a JSON spec. To keep the workspace root clean, write outputs into out/ (or out/_scratch/ for throwaway experiments):

/root/.openclaw/workspace/.venv-math/bin/python \
  skills/py-math-viz/scripts/plot_from_spec.py \
  --spec spec.json --out out/plots/plot.png

Then send out/plots/plot.png (Telegram: use the message tool with filePath).

Plot spec

The spec is intentionally small. Read:

  • references/spec.md — schema + examples
  • references/quick-recipes.md — recipes index (points to JSON specs / seaborn snippets / image tiling)

OpenCV helpers

Tile multiple PNGs into one (for comparisons):

/root/.openclaw/workspace/.venv-math/bin/python \
  skills/py-math-viz/scripts/tile_images.py \
  --out tiled.png img1.png img2.png img3.png

When NOT to use

  • Interactive dashboards (Plotly/Dash) unless explicitly asked
  • 3D/mesh-heavy rendering (use specialized tools if needed)