Turns numbers from a file or the chat into a clean chart picture (PNG, SVG or PDF) for slides, e-mails and documents.
Say it in your own words; the assistant finds this recipe by itself. Examples:
Make a chart as a picture file in ONE command, ready to paste into a slide, an e-mail or a document: bar, grouped or stacked bar, horizontal bar, line, area, pie, donut or scatter, from a CSV, Excel or JSON file or from numbers typed in the chat; totals or averages by group first if needed; clean style, values on the bars, Danish number format. PNG, SVG or PDF. Use for: a bar chart of sales per region, a pie of the budget split, a line of revenue per quarter for my slide, et søjlediagram over salget, a chart I can paste into Outlook. Triggers: chart, graph, diagram, bar chart, pie chart, line chart, plot, visualise, søjlediagram, lagkagediagram, kurve, picture of the numbers.
python3 /skills/chart-image/scripts/chart.py <kind> IN OUT.png --x COL --y COL[,COL] [options]
draws with matplotlib. Kinds: bar, stacked, hbar, line, area, pie, donut,
scatter. IN is a .csv, .xlsx, .json or .parquet in /work/in (or - with --inline);
OUT ends in .png, .svg or .pdf in /work/out. Prints one OK … line or one ERROR … line.
| Need | Command |
|---|---|
| Bar chart of a total per group | chart.py bar /work/in/sales.csv /work/out/units.png --x region --y units --agg sum --title "Units per region" --labels |
| Numbers from the chat | chart.py pie - /work/out/split.png --inline "DK:120,NO:90,SE:140,DE:60" --title "Share by country" |
| Several series (grouped bars, or lines) | chart.py line /work/in/q.csv /work/out/q.png --x quarter --y revenue,cost --title "Per quarter" |
| Stacked | chart.py stacked … --x quarter --y revenue,cost |
| Top N, sorted | chart.py hbar /work/in/sales.csv /work/out/top.png --x product --y units --agg sum --top 5 --sort desc --labels |
| Average instead of sum | add --agg mean (also count, max, min); group by another column with --by COL |
| Danish numbers (1.234,5) | add --locale da |
| Size and resolution | --size 20x10 (cm) --dpi 300; --colors warm or --colors "#0F5C6E,#F2B07B" |
| Legend position | --legend bottom (or none) |
Bar, pie and donut charts aggregate automatically when a category repeats (sum). More than
500 categories is refused: use --top N or --by. The chart has no top or right frame, a light
grid and readable labels, so it drops straight into a slide. Give the person the download link.
SKILL.mdgate.jsonscripts/__pycache__/chart.cpython-313.pycscripts/chart.pyWritten by Percerno, MIT licence.