Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Development skills for AI coding agents. Plug into your favorite AI coding tool
| `pptx-generator` | Generate, edit, and read PowerPoint presentations. Create from scratch with PptxGenJS (cover, TOC, content, section divider, summary slides), edit existing PPTX via XML workflows, or extract text with markitdown. |
| `minimax-xlsx` | Open, create, read, analyze, edit, or validate Excel/spreadsheet files (.xlsx, .xlsm, .csv, .tsv). Covers creating new xlsx from scratch via XML templates, reading and analyzing with pandas, editing existing files with zero format loss, formula recalculation, validation, and professional financial formatting. |
| `minimax-docx` | Professional DOCX document creation, editing, and formatting using OpenXML SDK (.NET). Three pipelines: create new documents from scratch, fill/edit content in existing documents, or apply template formatting with XSD validation gate-check. |
| `minimax-chart` | Generate publication-ready data visualizations from CSV, JSON, or inline data. Auto-detects chart type (bar, line, scatter, pie, heatmap, histogram). Four style presets (modern, vibrant, academic, dark). Outputs PNG, SVG, or PDF. |

## Installation

Expand Down
1 change: 1 addition & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
| `pptx-generator` | 生成、编辑和读取 PowerPoint 演示文稿。支持用 PptxGenJS 从零创建(封面、目录、内容、分节页、总结页),通过 XML 工作流编辑现有 PPTX,或用 markitdown 提取文本。 |
| `minimax-xlsx` | 打开、创建、读取、分析、编辑或验证 Excel/电子表格文件(.xlsx、.xlsm、.csv、.tsv)。支持通过 XML 模板从零创建 xlsx、使用 pandas 读取分析、零格式损失编辑现有文件、公式重算与验证、专业财务格式化。 |
| `minimax-docx` | 基于 OpenXML SDK(.NET)的专业 DOCX 文档创建、编辑与排版。三条流水线:从零创建新文档、填写/编辑现有文档内容、应用模板格式并通过 XSD 验证门控检查。 |
| `minimax-chart` | 从 CSV、JSON 或内联数据生成出版级数据可视化。自动检测图表类型(柱状图、折线图、散点图、饼图、热力图、直方图)。四种样式预设(现代、鲜明、学术、暗色)。输出 PNG、SVG 或 PDF。 |

## 安装

Expand Down
159 changes: 159 additions & 0 deletions skills/minimax-chart/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
---
name: minimax-chart
description: |
Generate publication-ready data visualizations from CSV, JSON, or inline data.
Use when: creating charts, graphs, plots, data visualizations, infographics,
turning data into visuals, visualizing CSV files, making bar charts, line charts,
pie charts, heatmaps, scatter plots.
Triggers: chart, graph, plot, visualize data, data visualization, bar chart,
line chart, pie chart, heatmap, scatter plot, CSV to chart.
license: MIT
metadata:
version: "1.0"
category: data-tools
output_format: png/svg/pdf
sources:
- matplotlib documentation
- seaborn documentation
---

# MiniMax Chart

Generate publication-ready charts and data visualizations.

## Prerequisites

Before starting, ensure:

1. **Python venv** is activated with dependencies from [requirements.txt](references/requirements.txt) installed

If matplotlib is not installed, set it up first:
```bash
pip install matplotlib pandas
```

## Workflow

### Step 0: Data Input

Accept data in one of these formats:

1. **CSV file** - `python3 scripts/chart_create.py data.csv -o chart.png`
2. **JSON file** - array of objects or `{labels: [], values: []}` structure
3. **Inline markdown table** - parse from user message
4. **Clipboard / pasted data** - tab-separated or comma-separated text

If the user pastes raw data, save it to a temporary CSV before processing.

### Step 1: Data Analysis

Examine the data to determine:

- **Column types**: numeric, categorical, datetime, text
- **Row count**: affects chart density and readability
- **Relationships**: correlations, time series patterns, distributions

Print a brief summary:
```
Data: 4 columns, 12 rows
- month (datetime): Jan 2024 - Dec 2024
- revenue (numeric): range 45K - 120K
- expenses (numeric): range 30K - 85K
- category (categorical): 3 unique values
```

### Step 2: Chart Type Selection

**Auto-detect the best chart type based on data shape:**

| Data Pattern | Recommended Chart | Why |
|---|---|---|
| 1 category + 1 numeric | Bar chart | Compare values across categories |
| Datetime + 1-3 numeric | Line chart | Show trends over time |
| 2 numeric columns | Scatter plot | Show correlation |
| 1 category (proportions) | Pie / donut chart | Show parts of a whole |
| Matrix / grid of values | Heatmap | Show intensity across 2 dimensions |
| Multiple groups + numeric | Grouped bar chart | Compare groups side by side |
| Distribution of 1 numeric | Histogram | Show value distribution |
| Category + subcategory + value | Stacked bar chart | Show composition within groups |

Present the recommendation and ask:
> "Based on your data, I recommend a {chart type}. Want to go with that, or prefer a different chart type?"

### Step 3: Style Selection

Offer style presets:

| Style | Description | Best for |
|---|---|---|
| `modern` | Clean, minimal, muted palette | Business reports, presentations |
| `vibrant` | Bold colors, high contrast | Marketing, social media |
| `academic` | Serif fonts, grayscale-friendly | Papers, publications |
| `dark` | Dark background, neon accents | Dashboards, tech content |

Default to `modern` unless the user specifies otherwise.

### Step 4: Generate Chart

**Tool**: `scripts/chart_create.py`

```bash
python3 scripts/chart_create.py data.csv \
--type bar \
--style modern \
--title "Monthly Revenue 2024" \
--xlabel "Month" --ylabel "Revenue ($)" \
-o chart.png
```

**Common options:**
```bash
# Line chart with multiple series
python3 scripts/chart_create.py data.csv --type line --columns revenue,expenses -o trend.png

# Pie chart from a single column
python3 scripts/chart_create.py data.csv --type pie --label-col category --value-col count -o breakdown.png

# Scatter plot with trend line
python3 scripts/chart_create.py data.csv --type scatter --x price --y sales --trend -o correlation.png

# Heatmap from a matrix CSV
python3 scripts/chart_create.py matrix.csv --type heatmap --cmap viridis -o heatmap.png

# Export as SVG for web use
python3 scripts/chart_create.py data.csv --type bar -o chart.svg --format svg
```

### Step 5: Iterate

Show the generated chart to the user. Offer adjustments:

- Change colors: `--palette "#2563EB,#DC2626,#16A34A"`
- Adjust size: `--width 12 --height 6`
- Add annotations: `--annotate`
- Change chart type: `--type line`
- Export different format: `--format svg` or `--format pdf`

Regenerate until the user is satisfied.

### Step 6: Deliver

Output format:
1. Chart file path
2. Brief description of what the chart shows

```
Chart created: "Monthly Revenue 2024"
File: chart.png (1200x800, 45KB)
Type: bar chart
Data: 12 months, revenue range $45K-$120K
```

## Rules

- Always label axes. Charts without labels are useless.
- Use readable font sizes. Title: 16pt, axis labels: 12pt, tick labels: 10pt.
- Limit pie charts to 6 slices max. Group small values as "Other".
- For time series, always sort by date on the x-axis.
- Default output size: 10x6 inches at 150 DPI (1500x900px). Adjust for specific needs.
- Prefer PNG for general use, SVG for web, PDF for print.
58 changes: 58 additions & 0 deletions skills/minimax-chart/references/chart-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Chart Type Selection Guide

How to pick the right chart for your data.

## Decision Tree

```
What are you showing?
├── Comparison across categories
│ ├── Few categories (< 7) → Bar chart
│ ├── Many categories (7+) → Horizontal bar chart
│ └── Parts of a whole → Pie / donut chart (max 6 slices)
├── Change over time
│ ├── Single metric → Line chart
│ ├── Multiple metrics → Multi-line chart
│ └── Cumulative → Area chart
├── Relationship between variables
│ ├── 2 numeric variables → Scatter plot
│ └── With trend → Scatter + trend line
├── Distribution
│ ├── Single variable → Histogram
│ └── Across categories → Box plot
└── Intensity / density
└── 2D grid of values → Heatmap
```

## Chart Type Reference

| Chart | Best for | Avoid when |
|-------|----------|------------|
| **Bar** | Comparing categories | More than 15 categories |
| **Line** | Trends over time | Unordered categories |
| **Scatter** | Correlation between 2 variables | Categorical data |
| **Pie** | Parts of a whole | More than 6 slices |
| **Histogram** | Value distribution | Categorical data |
| **Heatmap** | Intensity across 2 dimensions | Few data points |
| **Grouped bar** | Comparing groups within categories | Too many groups (>4) |
| **Stacked bar** | Composition within categories | When individual values matter more than totals |

## Style Guidelines

### Colors
- Use consistent colors for the same data series across multiple charts
- Avoid red/green together (color blindness)
- Use sequential colormaps (e.g., `YlOrRd`) for heatmaps
- Use distinct colors for categorical data

### Labels
- Always label both axes
- Include units in axis labels: "Revenue ($K)" not just "Revenue"
- Use title case for titles, sentence case for labels
- Rotate long x-axis labels 45 degrees

### Sizing
- Default: 10x6 inches at 150 DPI (1500x900px)
- Presentations: 12x7 inches at 200 DPI
- Print: 8x5 inches at 300 DPI
- Thumbnails: 6x4 inches at 100 DPI
2 changes: 2 additions & 0 deletions skills/minimax-chart/references/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
matplotlib>=3.7.0
pandas>=2.0.0
Loading