Chart image

From malue-ai/dazee-small · View interactive version

Chart image is an AI agent skill from the GitHub repository malue-ai/dazee-small. Generate publication-quality chart images from data using matplotlib. Supports bar, line, pie, scatter, and more.

How to use this skill

Skill file

数据图表生成

从数据生成高质量图表图片,支持柱状图、折线图、饼图、散点图等常见类型。

使用场景

执行方式

基本用法

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm

# 中文字体支持
plt.rcParams['font.sans-serif'] = ['PingFang SC', 'Microsoft YaHei', 'SimHei', 'DejaVu Sans']
plt.rcParams['axes.unicode_minus'] = False

fig, ax = plt.subplots(figsize=(10, 6))

# 示例:柱状图
categories = ['一月', '二月', '三月', '四月']
values = [120, 150, 180, 200]
ax.bar(categories, values, color='#4A90D9')

ax.set_title('月度销售额', fontsize=16, fontweight='bold')
ax.set_ylabel('金额(万元)')

plt.tight_layout()
plt.savefig('/tmp/chart.png', dpi=150, bbox_inches='tight')
plt.close()

支持的图表类型

| 类型 | 方法 | 适用场景 |

|---|---|---|

| 柱状图 | ax.bar() | 分类对比 |

| 折线图 | ax.plot() | 趋势变化 |

| 饼图 | ax.pie() | 占比分析 |

| 散点图 | ax.scatter() | 相关性分析 |

| 水平柱状图 | ax.barh() | 排名对比 |

| 堆叠图 | ax.bar(bottom=) | 组成分析 |

样式规范

输出规范

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.