← 返回
未分类 中文

Chart MPL

Generate PNG/SVG charts (line, bar, hbar, pie, stacked, scatter, area) from CSV data using matplotlib. Use when the user asks to visualize tabular data, prod...
使用matplotlib从CSV数据生成PNG/SVG图表(折线、柱状、水平柱状、饼图、堆叠、散点、面积图),用于用户请求可视化表格数据的场景。
mohamed-hammane
未分类 clawhub v1.1.0 2 版本 100000 Key: 无需
★ 0
Stars
📥 526
下载
💾 9
安装
2
版本
#latest

概述

Chart MPL

Generate chart images from CSV files with scripts/chart_mpl.py.

Setup

Create a virtual environment and install matplotlib (one-time):

python3 -m venv ~/.openclaw/workspace/.venv_chart
~/.openclaw/workspace/.venv_chart/bin/pip install matplotlib

Quick start

Run from workspace root:

~/.openclaw/workspace/.venv_chart/bin/python skills/chart-mpl/scripts/chart_mpl.py \
  --csv /path/to/data.csv \
  --xcol Mois \
  --ycol Valeur \
  --kind line \
  --title "Monthly trend" \
  --xlabel "Month" \
  --ylabel "Value"

Output defaults to:

~/.openclaw/workspace/exports/images

Inputs

  • --csv path to CSV file
  • --xcol column for X axis
  • --ycol numeric column(s) for Y axis — comma-separated for multi-series (e.g. Sales,Costs)
  • --kind chart type: line, bar, hbar, pie, stacked, scatter, area
  • Optional: --delim if auto-detection fails (;, ,, \t, |)
  • Optional: --out custom output path (PNG or SVG — format detected from extension)
  • Optional: --title, --xlabel, --ylabel
  • Optional: --top N show only top N categories by value (bar, hbar, pie, stacked). Multi-series ranks by row total.
  • Optional: --sort sort data before plotting: x-asc, x-desc, y-desc, none (default: none)
  • Optional: --numfmt number format on Y axis: fr (1,5M) or en (1.5M) — default: fr

Chart types

KindDescriptionMulti-series
-------------------------------------------------:------------:
lineLine chart with markersyes
barVertical bar chart (grouped when multi-series)yes
hbarHorizontal bar chart (grouped when multi-series)yes
piePie chart (first Y column only)no
stackedStacked vertical bar (requires 2+ Y)yes
scatterScatter plotyes
areaFilled area chartyes

Notes

  • Script auto-detects delimiters when possible.
  • Script tolerates European and US numeric formats (1 234,56, 1,234.56).
  • Non-numeric values in ycol are converted to NaN with a warning.
  • Handles BOM-encoded CSV files (utf-8-sig).
  • Multi-series charts automatically show a legend and cycle through an 8-color palette.
  • Y-axis ticks use human-readable formatting (K, M, G suffixes) with French or English decimals.
  • --top N keeps the N highest categories. For pie charts, the remainder is aggregated into an "Other" slice. For bar/hbar/stacked, the rest are excluded.
  • Output format (PNG or SVG) is detected from the --out file extension. Default is PNG.

End-to-end flow with SQL skill

  1. Export query result to CSV using the mssql skill.
  2. Run this script on that CSV.
  3. Share the generated PNG path.

版本历史

共 2 个版本

  • v1.1.0 当前
    2026-05-03 05:33 安全 安全
  • v1.0.0
    2026-03-30 21:22 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

IMAP SMTP Email

mohamed-hammane
使用本地 Node脚本通过 IMAP/SMTP 读取和发送邮件,适用于需要检查收件箱、获取邮件内容、搜索邮件、下载附件等场景。
★ 0 📥 452

PDF Report

mohamed-hammane
使用 Jinja2 和 WeasyPrint 从结构化 JSON 生成整洁的 A4 PDF 报告,适用于需要格式化 PDF 文档的场景,如分析摘要、数据报告等。
★ 0 📥 581

Excel Export

mohamed-hammane
从结构化JSON生成精美的.xlsx工作簿,支持多工作表、冻结表头、筛选、类型化列、公式、合计以及法国/摩洛哥格式。
★ 0 📥 459