Token导航 LogoToken导航

Agent Skill · 前端设计

chart-generator(图表生成器)

chart-generator 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

chart-generator 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 5,818。

总安装 599周安装 24GitHub Stars 26下载 194核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:chart-generator(图表生成器)
来源仓库:https://github.com/curiouslearner/devkit
仓库路径:skills/chart-generator
安装命令:
npx skills add https://github.com/curiouslearner/devkit --skill chart-generator
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/curiouslearner/devkit --skill chart-generator

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

chart-generator 根据数据结构自动生成各类图表,支持热力图、树图与多维时间序列展示。适用于教育内容、文档站点中的嵌入式图表构建,强调样式统一与主题适配。输出包含完整样式定义的配置代码,需配合前端框架(如 React)实际渲染。不提供数据获取功能,所有输入必须由用户提供或通过其他技能获取。

适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/chart-generator

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/curiouslearner/devkit --skill chart-generator;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

chart-generator 怎么安装?

在终端执行 npx skills add https://github.com/curiouslearner/devkit --skill chart-generator。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

chart-generator 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

chart-generator 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

chart-generator 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

chart-generator 用的人多吗?

公开数据是累计安装 599 次,近一周安装 24 次,下载 194 次,GitHub 26 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

chart-generator 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
chart-generator

图表生成器 · 本页

59926需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Chart Generator Skill

Generate charts and visualizations from data using various charting libraries and formats.

Instructions

You are a data visualization expert. When invoked:

  1. Analyze Data:

- Understand data structure and types - Identify appropriate chart types - Detect data patterns and trends - Calculate aggregations and statistics - Determine visualization goals

  1. Generate Charts:

- Create bar, line, pie, scatter plots - Generate heatmaps and tree maps - Create histograms and box plots - Build time series visualizations - Design multi-dimensional charts

  1. Style and Customize:

- Apply color schemes and themes - Add labels, legends, and annotations - Format axes and gridlines - Customize tooltips and interactions - Ensure accessibility and readability

  1. Export and Embed:

- Save as PNG, SVG, PDF - Generate interactive HTML charts - Embed in markdown reports - Create chart APIs - Support responsive design

Usage Examples

@chart-generator data.csv --type bar
@chart-generator --line --time-series
@chart-generator --pie --group-by category
@chart-generator --scatter x:age y:income
@chart-generator --heatmap --correlation
@chart-generator --interactive --html

Chart Types and Use Cases

When to Use Each Chart Type

Chart TypeBest ForExample Use Case
Bar ChartComparing categoriesSales by product
Line ChartTrends over timeRevenue over months
Pie ChartPart-to-whole relationshipsMarket share
Scatter PlotRelationships between variablesHeight vs Weight
HistogramDistribution of valuesAge distribution
Box PlotStatistical distributionSalary ranges by department
HeatmapMatrix data, correlationsFeature correlations
Area ChartCumulative trendsStacked revenue streams
Bubble Chart3-dimensional dataSales vs Profit vs Market Share
TreemapHierarchical dataDisk space usage

Python - Matplotlib

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

def create_bar_chart(data, x_col, y_col, title='Bar Chart', output='chart.png'):
    """
    Create a bar chart
    """
    plt.figure(figsize=(10, 6))

    if isinstance(data, pd.DataFrame):
        x = data[x_col]
        y = data[y_col]
    else:
        x = data['labels']
        y = data['values']

    bars = plt.bar(x, y, color='steelblue', alpha=0.8)

    # Add value labels on bars
    for bar in bars:
        height = bar.get_height()
        plt.text(bar.get_x() + bar.get_width()/2., height,
                f'{height:.1f}',
                ha='center', va='bottom')

    plt.title(title, fontsize=16, fontweight='bold')
    plt.xlabel(x_col if isinstance(data, pd.DataFrame) else 'Category', fontsize=12)
    plt.ylabel(y_col if isinstance(data, pd.DataFrame) else 'Value', fontsize=12)
    plt.xticks(rotation=45, ha='right')
    plt.grid(axis='y', alpha=0.3)
    plt.tight_layout()

    plt.savefig(output, dpi=300, bbox_inches='tight')
    plt.close()

    return output

def create_line_chart(data, x_col, y_col, title='Line Chart', output='chart.png'):
    """
    Create a line chart
    """
    plt.figure(figsize=(12, 6))

    if isinstance(data, pd.DataFrame):
        x = data[x_col]
        y = data[y_col]
    else:
        x = data['x']
        y = data['y']

    plt.plot(x, y, marker='o', linewidth=2, markersize=6, color='steelblue')

    # Add grid
    plt.grid(True, alpha=0.3)

    plt.title(title, fontsize=16, fontweight='bold')
    plt.xlabel(x_col if isinstance(data, pd.DataFrame) else 'X', fontsize=12)
    plt.ylabel(y_col if isinstance(data, pd.DataFrame) else 'Y', fontsize=12)
    plt.xticks(rotation=45, ha='right')
    plt.tight_layout()

    plt.savefig(output, dpi=300, bbox_inches='tight')
    plt.close()

    return output

def create_pie_chart(data, labels_col, values_col, title='Pie Chart', output='chart.png'):
    """
    Create a pie chart
    """
    plt.figure(figsize=(10, 8))

    if isinstance(data, pd.DataFrame):
        labels = data[labels_col]
        values = data[values_col]
    else:
        labels = data['labels']
        values = data['values']

    # Create color palette
    colors = plt.cm.Set3(np.linspace(0, 1, len(labels)))

    # Create pie chart
    wedges, texts, autotexts = plt.pie(
        values,
        labels=labels,
        autopct='%1.1f%%',
        startangle=90,
        colors=colors,
        explode=[0.05] * len(labels)  # Slightly separate slices
    )

    # Style percentage text
    for autotext in autotexts:
        autotext.set_color('white')
        autotext.set_fontweight('bold')
        autotext.set_fontsize(10)

    plt.title(title, fontsize=16, fontweight='bold')
    plt.axis('equal')
    plt.tight_layout()

    plt.savefig(output, dpi=300, bbox_inches='tight')
    plt.close()

    return output

def create_scatter_plot(data, x_col, y_col, color_col=None, size_col=None,
                       title='Scatter Plot', output='chart.png'):
    """
    Create a scatter plot
    """
    plt.figure(figsize=(10, 8))

    if isinstance(data, pd.DataFrame):
        x = data[x_col]
        y = data[y_col]
        c = data[color_col] if color_col else None
        s = data[size_col] if size_col else 50
    else:
        x = data['x']
        y = data['y']
        c = None
        s = 50

    scatter = plt.scatter(x, y, c=c, s=s, alpha=0.6, cmap='viridis')

    if color_col:
        plt.colorbar(scatter, label=color_col)

    # Add trend line
    z = np.polyfit(x, y, 1)
    p = np.poly1d(z)
    plt.plot(x, p(x), "r--", alpha=0.8, label='Trend')

    plt.title(title, fontsize=16, fontweight='bold')
    plt.xlabel(x_col if isinstance(data, pd.DataFrame) else 'X', fontsize=12)
    plt.ylabel(y_col if isinstance(data, pd.DataFrame) else 'Y', fontsize=12)
    plt.grid(True, alpha=0.3)
    plt.legend()
    plt.tight_layout()

    plt.savefig(output, dpi=300, bbox_inches='tight')
    plt.close()

    return output

def create_histogram(data, column, bins=30, title='Histogram', output='chart.png'):
    """
    Create a histogram
    """
    plt.figure(figsize=(10, 6))

    if isinstance(data, pd.DataFrame):
        values = data[column]
    else:
        values = data

    n, bins, patches = plt.hist(values, bins=bins, color='steelblue',
                                 alpha=0.7, edgecolor='black')

    # Add mean line
    mean_val = np.mean(values)
    plt.axvline(mean_val, color='red', linestyle='dashed', linewidth=2,
                label=f'Mean: {mean_val:.2f}')

    # Add median line
    median_val = np.median(values)
    plt.axvline(median_val, color='green', linestyle='dashed', linewidth=2,
                label=f'Median: {median_val:.2f}')

    plt.title(title, fontsize=16, fontweight='bold')
    plt.xlabel(column if isinstance(data, pd.DataFrame) else 'Value', fontsize=12)
    plt.ylabel('Frequency', fontsize=12)
    plt.legend()
    plt.grid(axis='y', alpha=0.3)
    plt.tight_layout()

    plt.savefig(output, dpi=300, bbox_inches='tight')
    plt.close()

    return output

def create_box_plot(data, columns, title='Box Plot', output='chart.png'):
    """
    Create a box plot
    """
    plt.figure(figsize=(10, 6))

    if isinstance(data, pd.DataFrame):
        data_to_plot = [data[col].dropna() for col in columns]
        labels = columns
    else:
        data_to_plot = data
        labels = [f'Group {i+1}' for i in range(len(data))]

    bp = plt.boxplot(data_to_plot, labels=labels, patch_artist=True)

    # Color boxes
    for patch in bp['boxes']:
        patch.set_facecolor('lightblue')
        patch.set_alpha(0.7)

    plt.title(title, fontsize=16, fontweight='bold')
    plt.ylabel('Value', fontsize=12)
    plt.grid(axis='y', alpha=0.3)
    plt.xticks(rotation=45, ha='right')
    plt.tight_layout()

    plt.savefig(output, dpi=300, bbox_inches='tight')
    plt.close()

    return output

def create_heatmap(data, title='Heatmap', output='chart.png'):
    """
    Create a heatmap (correlation matrix)
    """
    plt.figure(figsize=(10, 8))

    if isinstance(data, pd.DataFrame):
        # Calculate correlation matrix
        corr_matrix = data.corr()
    else:
        corr_matrix = data

    # Create heatmap
    im = plt.imshow(corr_matrix, cmap='coolwarm', aspect='auto',
                    vmin=-1, vmax=1)

    # Add colorbar
    cbar = plt.colorbar(im)
    cbar.set_label('Correlation', rotation=270, labelpad=20)

    # Set ticks and labels
    plt.xticks(range(len(corr_matrix.columns)), corr_matrix.columns,
               rotation=45, ha='right')
    plt.yticks(range(len(corr_matrix.columns)), corr_matrix.columns)

    # Add correlation values
    for i in range(len(corr_matrix)):
        for j in range(len(corr_matrix.columns)):
            text = plt.text(j, i, f'{corr_matrix.iloc[i, j]:.2f}',
                          ha='center', va='center', color='black', fontsize=9)

    plt.title(title, fontsize=16, fontweight='bold', pad=20)
    plt.tight_layout()

    plt.savefig(output, dpi=300, bbox_inches='tight')
    plt.close()

    return output

Python - Seaborn

import seaborn as sns

def create_seaborn_chart(data, chart_type, x, y=None, hue=None,
                        title='Chart', output='chart.png'):
    """
    Create charts using Seaborn
    """
    plt.figure(figsize=(12, 6))

    # Set style
    sns.set_style("whitegrid")
    sns.set_palette("husl")

    if chart_type == 'bar':
        sns.barplot(data=data, x=x, y=y, hue=hue)

    elif chart_type == 'line':
        sns.lineplot(data=data, x=x, y=y, hue=hue, marker='o')

    elif chart_type == 'scatter':
        sns.scatterplot(data=data, x=x, y=y, hue=hue, size=hue, alpha=0.6)

    elif chart_type == 'box':
        sns.boxplot(data=data, x=x, y=y, hue=hue)

    elif chart_type == 'violin':
        sns.violinplot(data=data, x=x, y=y, hue=hue)

    elif chart_type == 'dist':
        sns.histplot(data=data, x=x, hue=hue, kde=True)

    elif chart_type == 'heatmap':
        sns.heatmap(data.corr(), annot=True, fmt='.2f', cmap='coolwarm',
                   center=0, square=True, linewidths=1)

    elif chart_type == 'pairplot':
        # Special case - creates its own figure
        g = sns.pairplot(data, hue=hue)
        g.savefig(output, dpi=300, bbox_inches='tight')
        return output

    plt.title(title, fontsize=16, fontweight='bold')
    plt.xticks(rotation=45, ha='right')
    plt.tight_layout()

    plt.savefig(output, dpi=300, bbox_inches='tight')
    plt.close()

    return output

# Advanced Seaborn visualizations
def create_facet_grid(data, x, y, col=None, row=None, hue=None,
                     title='Facet Grid', output='chart.png'):
    """
    Create faceted charts
    """
    g = sns.FacetGrid(data, col=col, row=row, hue=hue, height=4)
    g.map(sns.scatterplot, x, y, alpha=0.6)
    g.add_legend()
    g.fig.suptitle(title, y=1.02, fontsize=16, fontweight='bold')

    plt.savefig(output, dpi=300, bbox_inches='tight')
    plt.close()

    return output

JavaScript - Chart.js

const { ChartJSNodeCanvas } = require('chartjs-node-canvas');

async function createBarChart(data, options = {}) {
  const width = options.width || 800;
  const height = options.height || 600;

  const chartJSNodeCanvas = new ChartJSNodeCanvas({ width, height });

  const configuration = {
    type: 'bar',
    data: {
      labels: data.labels,
      datasets: [{
        label: options.label || 'Dataset',
        data: data.values,
        backgroundColor: 'rgba(54, 162, 235, 0.6)',
        borderColor: 'rgba(54, 162, 235, 1)',
        borderWidth: 2
      }]
    },
    options: {
      responsive: true,
      plugins: {
        title: {
          display: true,
          text: options.title || 'Bar Chart',
          font: { size: 18 }
        },
        legend: {
          display: true,
          position: 'top'
        }
      },
      scales: {
        y: {
          beginAtZero: true
        }
      }
    }
  };

  const imageBuffer = await chartJSNodeCanvas.renderToBuffer(configuration);
  return imageBuffer;
}

async function createLineChart(data, options = {}) {
  const width = options.width || 800;
  const height = options.height || 600;

  const chartJSNodeCanvas = new ChartJSNodeCanvas({ width, height });

  const configuration = {
    type: 'line',
    data: {
      labels: data.labels,
      datasets: [{
        label: options.label || 'Dataset',
        data: data.values,
        borderColor: 'rgba(75, 192, 192, 1)',
        backgroundColor: 'rgba(75, 192, 192, 0.2)',
        borderWidth: 2,
        tension: 0.4
      }]
    },
    options: {
      responsive: true,
      plugins: {
        title: {
          display: true,
          text: options.title || 'Line Chart',
          font: { size: 18 }
        }
      },
      scales: {
        y: {
          beginAtZero: true
        }
      }
    }
  };

  const imageBuffer = await chartJSNodeCanvas.renderToBuffer(configuration);
  return imageBuffer;
}

async function createPieChart(data, options = {}) {
  const width = options.width || 800;
  const height = options.height || 600;

  const chartJSNodeCanvas = new ChartJSNodeCanvas({ width, height });

  const configuration = {
    type: 'pie',
    data: {
      labels: data.labels,
      datasets: [{
        data: data.values,
        backgroundColor: [
          'rgba(255, 99, 132, 0.6)',
          'rgba(54, 162, 235, 0.6)',
          'rgba(255, 206, 86, 0.6)',
          'rgba(75, 192, 192, 0.6)',
          'rgba(153, 102, 255, 0.6)',
          'rgba(255, 159, 64, 0.6)'
        ],
        borderWidth: 2
      }]
    },
    options: {
      responsive: true,
      plugins: {
        title: {
          display: true,
          text: options.title || 'Pie Chart',
          font: { size: 18 }
        },
        legend: {
          position: 'right'
        }
      }
    }
  };

  const imageBuffer = await chartJSNodeCanvas.renderToBuffer(configuration);
  return imageBuffer;
}

Interactive Charts - Plotly

import plotly.express as px
import plotly.graph_objects as go

def create_interactive_bar(data, x, y, title='Bar Chart', output='chart.html'):
    """
    Create interactive bar chart with Plotly
    """
    fig = px.bar(data, x=x, y=y, title=title,
                 color=y, color_continuous_scale='Viridis')

    fig.update_layout(
        font=dict(size=14),
        showlegend=True,
        hovermode='x unified'
    )

    fig.write_html(output)
    return output

def create_interactive_line(data, x, y, title='Line Chart', output='chart.html'):
    """
    Create interactive line chart
    """
    fig = px.line(data, x=x, y=y, title=title, markers=True)

    fig.update_traces(line=dict(width=3))

    fig.update_layout(
        hovermode='x unified',
        font=dict(size=14)
    )

    fig.write_html(output)
    return output

def create_interactive_scatter(data, x, y, color=None, size=None,
                              title='Scatter Plot', output='chart.html'):
    """
    Create interactive scatter plot
    """
    fig = px.scatter(data, x=x, y=y, color=color, size=size,
                    title=title, hover_data=data.columns)

    fig.update_traces(marker=dict(line=dict(width=0.5, color='white')))

    fig.write_html(output)
    return output

def create_3d_scatter(data, x, y, z, color=None, title='3D Scatter',
                     output='chart.html'):
    """
    Create 3D scatter plot
    """
    fig = px.scatter_3d(data, x=x, y=y, z=z, color=color, title=title)

    fig.update_layout(scene=dict(
        xaxis_title=x,
        yaxis_title=y,
        zaxis_title=z
    ))

    fig.write_html(output)
    return output

def create_time_series(data, date_col, value_col, title='Time Series',
                      output='chart.html'):
    """
    Create time series chart
    """
    fig = go.Figure()

    fig.add_trace(go.Scatter(
        x=data[date_col],
        y=data[value_col],
        mode='lines+markers',
        name=value_col,
        line=dict(width=2),
        marker=dict(size=6)
    ))

    # Add range slider
    fig.update_xaxes(
        rangeslider_visible=True,
        rangeselector=dict(
            buttons=list([
                dict(count=7, label="1w", step="day", stepmode="backward"),
                dict(count=1, label="1m", step="month", stepmode="backward"),
                dict(count=3, label="3m", step="month", stepmode="backward"),
                dict(count=1, label="1y", step="year", stepmode="backward"),
                dict(step="all")
            ])
        )
    )

    fig.update_layout(
        title=title,
        xaxis_title=date_col,
        yaxis_title=value_col,
        font=dict(size=14)
    )

    fig.write_html(output)
    return output

def create_dashboard(data, output='dashboard.html'):
    """
    Create multi-chart dashboard
    """
    from plotly.subplots import make_subplots

    fig = make_subplots(
        rows=2, cols=2,
        subplot_titles=('Bar Chart', 'Line Chart', 'Pie Chart', 'Scatter Plot'),
        specs=[[{'type': 'bar'}, {'type': 'scatter'}],
               [{'type': 'pie'}, {'type': 'scatter'}]]
    )

    # Add charts
    # Bar chart
    fig.add_trace(
        go.Bar(x=data['category'], y=data['value1'], name='Bar'),
        row=1, col=1
    )

    # Line chart
    fig.add_trace(
        go.Scatter(x=data['date'], y=data['value2'], mode='lines', name='Line'),
        row=1, col=2
    )

    # Pie chart
    fig.add_trace(
        go.Pie(labels=data['category'], values=data['value1'], name='Pie'),
        row=2, col=1
    )

    # Scatter plot
    fig.add_trace(
        go.Scatter(x=data['value1'], y=data['value2'], mode='markers', name='Scatter'),
        row=2, col=2
    )

    fig.update_layout(height=800, showlegend=True, title_text="Dashboard")

    fig.write_html(output)
    return output

Chart Styling and Themes

# Matplotlib themes
def apply_matplotlib_theme(theme='default'):
    """
    Apply theme to matplotlib charts
    """
    themes = {
        'default': 'seaborn-v0_8-darkgrid',
        'minimal': 'seaborn-v0_8-whitegrid',
        'dark': 'dark_background',
        'classic': 'classic',
        'ggplot': 'ggplot'
    }

    plt.style.use(themes.get(theme, 'default'))

# Custom color palettes
COLOR_PALETTES = {
    'corporate': ['#003f5c', '#58508d', '#bc5090', '#ff6361', '#ffa600'],
    'pastel': ['#a8e6cf', '#dcedc1', '#ffd3b6', '#ffaaa5', '#ff8b94'],
    'vibrant': ['#e74c3c', '#3498db', '#2ecc71', '#f39c12', '#9b59b6'],
    'monochrome': ['#2c3e50', '#34495e', '#7f8c8d', '#95a5a6', '#bdc3c7']
}

def apply_color_palette(palette_name='corporate'):
    """Apply custom color palette"""
    colors = COLOR_PALETTES.get(palette_name, COLOR_PALETTES['corporate'])
    plt.rcParams['axes.prop_cycle'] = plt.cycler(color=colors)

Export Formats

def export_chart_multiple_formats(fig, base_name='chart'):
    """
    Export chart in multiple formats
    """
    formats = {
        'png': {'dpi': 300, 'transparent': False},
        'svg': {'format': 'svg'},
        'pdf': {'format': 'pdf'},
        'jpg': {'dpi': 300, 'format': 'jpg'}
    }

    files = []

    for fmt, kwargs in formats.items():
        output_file = f"{base_name}.{fmt}"
        fig.savefig(output_file, bbox_inches='tight', **kwargs)
        files.append(output_file)

    return files

Chart Generation Pipeline

def generate_charts_from_data(data, chart_configs, output_dir='charts'):
    """
    Generate multiple charts from data based on configurations

    chart_configs = [
        {
            'type': 'bar',
            'x': 'category',
            'y': 'value',
            'title': 'Sales by Category',
            'output': 'sales_bar.png'
        },
        ...
    ]
    """
    import os
    os.makedirs(output_dir, exist_ok=True)

    generated_charts = []

    for config in chart_configs:
        chart_type = config['type']
        output = os.path.join(output_dir, config['output'])

        if chart_type == 'bar':
            create_bar_chart(data, config['x'], config['y'],
                           config.get('title', 'Chart'), output)

        elif chart_type == 'line':
            create_line_chart(data, config['x'], config['y'],
                            config.get('title', 'Chart'), output)

        elif chart_type == 'pie':
            create_pie_chart(data, config['x'], config['y'],
                           config.get('title', 'Chart'), output)

        elif chart_type == 'scatter':
            create_scatter_plot(data, config['x'], config['y'],
                              config.get('color'), config.get('size'),
                              config.get('title', 'Chart'), output)

        elif chart_type == 'heatmap':
            create_heatmap(data, config.get('title', 'Chart'), output)

        generated_charts.append({
            'type': chart_type,
            'title': config.get('title'),
            'file': output
        })

    return generated_charts

Best Practices

  1. Choose appropriate chart types for your data
  2. Use clear, descriptive titles and labels
  3. Apply consistent color schemes across charts
  4. Ensure readability (font sizes, contrast)
  5. Add context (annotations, reference lines)
  6. Export in high resolution (300 DPI minimum)
  7. Consider accessibility (color-blind friendly palettes)
  8. Test on different screen sizes (responsive design)
  9. Optimize file sizes for web use
  10. Document chart generation code for reproducibility

Common Chart Patterns

Comparison Charts

  • Bar charts for categorical comparisons
  • Grouped bar charts for multi-series comparison
  • Stacked bar charts for part-to-whole comparisons

Trend Charts

  • Line charts for time series
  • Area charts for cumulative trends
  • Sparklines for inline trends

Distribution Charts

  • Histograms for frequency distribution
  • Box plots for statistical distribution
  • Violin plots for distribution shape

Relationship Charts

  • Scatter plots for correlations
  • Bubble charts for 3D relationships
  • Heatmaps for matrix relationships

Composition Charts

  • Pie charts for simple part-to-whole
  • Stacked area charts for trends over time
  • Treemaps for hierarchical composition

Notes

  • Always label axes and provide units
  • Use appropriate scales (linear, logarithmic)
  • Consider data-ink ratio (minimize chart junk)
  • Test charts with different data ranges
  • Provide legends when using multiple series
  • Use annotations to highlight key insights
  • Export charts in vector formats for publications
  • Keep color schemes consistent across related charts
  • Consider cultural differences in color meanings
  • Validate data before visualization

平台分布

Codex

38.26%
按下载量换算74

Claude

29.18%
按下载量换算57

Cursor

19.71%
按下载量换算38

Gemini CLI

10.06%
按下载量换算20

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills