技能版本 1.0.0

data-visualization

Create effective data visualizations with Python. 优先使用 plotly(交互式图表),seaborn 和 matplotlib 作为备选(静态图表)。Use when building charts, choosing the right chart type for a dataset, creating publication-quality figures, or applying design principles like accessibility and color theory.

价格

免费

  • 安装:免费

在组织开通时一次性收取;再次读取清单或下载不重复收费。

以上为公开标价。你的组织可能有协议价,以控制台显示的价格为准。

如何使用

  1. 为组织安装

    开通即安装:组织固定使用开通时的版本(当前为 1.0.0)。升级到新版本需要取消后重新开通。

  2. 创建凭证

    客户端使用组织凭证读取;绑定到数字人后,数字人使用绑定凭证按需加载。请求中携带:

    Authorization: Bearer $ZGI_MARKET_KEY

  3. 读取清单与安装包

    清单列出版本、文件和校验值;安装包是一个 zip 文件。

    读取清单
    curl "https://market-api.zgi.im/v1/market/skills/data-visualization/manifest" \
      -H "Authorization: Bearer $ZGI_MARKET_KEY"
    下载安装包
    curl "https://market-api.zgi.im/v1/market/skills/data-visualization/package" \
      -H "Authorization: Bearer $ZGI_MARKET_KEY" \
      -o data-visualization.zip

    读取清单和下载安装包不计入用量。下载后请用响应头中的 SHA-256 校验文件。

技能说明

名称
data-visualization
说明
Create effective data visualizations with Python. 优先使用 plotly(交互式图表),seaborn 和 matplotlib 作为备选(静态图表)。Use when building charts, choosing the right chart type for a dataset, creating publication-quality figures, or applying design principles like accessibility and color theory.
仅指令

技能包内没有脚本文件:这个技能是供模型阅读的文本。

SKILL.md 节选

# Data Visualization Skill

Chart selection guidance, Python visualization code patterns, design principles, and accessibility considerations for creating effective data visualizations.

## Chart Selection Guide

### Choose by Data Relationship

| What You're Showing | Best Chart | Alternatives |
|---|---|---|
| **Trend over time** | Line chart | Area chart (if showing cumulative or composition) |
| **Comparison across categories** | Vertical bar chart | Horizontal bar (many categories), lollipop chart |
| **Ranking** | Horizontal bar chart | Dot plot, slope chart (comparing two periods) |
| **Part-to-whole composition** | Stacked bar chart | Treemap (hierarchical), waffle chart |
| **Composition over time** | Stacked area chart | 100% stacked bar (for proportion focus) |
| **Distribution** | Histogram | Box plot (comparing groups), violin plot, strip plot |
| **Correlation (2 variables)** | Scatter plot | Bubble chart (add 3rd variable as size) |
| **Correlation (many variables)** | Heatmap (correlation matrix) | Pair plot |
| **Geographic patterns** | Choropleth map | Bubble map, hex map |
| **Flow / process** | Sankey diagram | Funnel chart (sequential stages) |
| **Relationship network** | Network graph | Chord diagram |
| **Performance vs. target** | Bullet chart | Gauge (single KPI only) |
| **Multiple KPIs at once** | Small multiples | Dashboard with separate charts |

### When NOT to Use Certain Charts

- **Pie charts**: Avoid unless <6 categories and exact proportions matter less than rough comparison. Humans are bad at comparing angles. Use bar charts instead.
- **3D charts**: Never. They distort perception and add no information.
- **Dual-axis charts**: Use cautiously. They can mislead by implying correlation. Clearly label both axes if used.
- **Stacked bar (many categories)**: Hard to compare middle segments. Use small multiples or grouped bars instead.
- **Donut charts**: Slightly better than pie charts but same fundamental issues. Use for single KPI display at most.

## Python Visualization Code Patterns

### 📌 Library Priority

**优先使用 Plotly(推荐)**
- 交互式图表,支持缩放、悬停、筛选
- 适合探索性分析和仪表板
- 输出为 HTML 文件,易于分享

**备选方案:Seaborn / Matplotlib**
- 静态图表,适合报告和出版物
- 更精细的样式控制
- 轻量级,无需 JavaScript

---

## Interactive Charts with Plotly(推荐优先使用)

### Setup

```python
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
```

### Line Chart (Time Series)

```python
# Simple interactive line chart
fig = px.line(df, x='date', y='value', color='category',
              title='Interactive Metric Trend',
              labels={'value': 'Metric Value', 'date': 'Date'},
              template='plotly_white')

fig.update_layout(
    hovermode='x unified',
    font=dict(size=12),
    title_font_size=16
)

fig.write_html('interactive_chart.html')
fig.show()
```

### Bar Chart (Comparison)

```python
# Horizontal bar chart with sorting
df_sorted = df.sort_values('metric', ascending=True)

fig = px.bar(df_sorted, x='metric', y='category', 
             orientation='h',
             title='Metric by Category (Ranked)',
             labels={'metric': 'Metric Value', 'category': 'Category'},
             template='plotly_white')

fig.update_traces(marker_color='#4C72B0', text=df_sorted['metric'])
fig.update_layout(showlegend=False)
fig.show()
```

### Scatter Plot (Correlation)

```python
# Interactive scatter with hover data
fig = px.scatter(df, x='metric_a', y='metric_b', 
                 color='category',
                 size='size_metric', 
                 hover_data=['name', 'detail_field'],
                 title='Correlation Analysis',
                 template='plotly_white')

fig.update_traces(marker=dict(line=dict(width=0.5, color='DarkSlateGrey')))
fig.show()
```

### Histogram (Distribution)

```python
fig = px.histogram(df, x='value', nbins=30,
                   title='Distribution of Values',

SKILL.md 不止这些内容,安装后可阅读全文。

技能包内容

共 1 个文件,合计 13.4 KiB

  • SKILL.md13.4 KiB

来源与审核

审核状态
尚未审核,内容来自上游来源
许可证
未说明

审核状态是平台对上架信息的记录,不构成对上游服务质量或可用性的担保。