claude-skills/

Anthropic公式スキル・プラグインの日本語ディレクトリ

last sync 22h ago
スキルKnowledge Work

📊create-viz

プラグイン
Data
引数
<data source> [chart type]

説明

Pythonを使用して出版品質のビジュアライゼーションを作成します。 次のような場合に使用: - クエリ結果またはDataFrameをチャートに変換したいとき - トレンドや比較に適したチャートタイプを選択したいとき - レポートやプレゼンテーション用のプロットを生成したいとき - ホバーやズーム機能を備えたインタラクティブなチャートが必要なとき

原文を表示

Create publication-quality visualizations with Python. Use when turning query results or a DataFrame into a chart, selecting the right chart type for a trend or comparison, generating a plot for a report or presentation, or needing an interactive chart with hover and zoom.

ユースケース

  • クエリ結果またはDataFrameをチャートに変換したい
  • トレンドや比較に適したチャートタイプを選択したい
  • レポートやプレゼンテーション用のプロットを生成したい
  • ホバーやズーム機能を備えたインタラクティブなチャートが必要

本文(日本語訳)

/create-viz - ビジュアライゼーションの作成

見慣れないプレースホルダーが表示される場合や、接続されているツールを確認したい場合は、CONNECTORS.md を参照してください。

Pythonを使用して、出版品質のデータビジュアライゼーションを作成します。 明確さ・正確さ・デザインのベストプラクティスに従い、データからチャートを生成します。

使い方

/create-viz <データソース> [チャートの種類] [追加の指示]

ワークフロー

1. リクエストの把握

以下の項目を確認します:

  • データソース: クエリ結果、貼り付けデータ、CSV/Excelファイル、またはこれからクエリするデータ
  • チャートの種類: 明示的に指定されているか、推奨が必要か
  • 目的: 探索的分析、プレゼンテーション、レポート、ダッシュボードのコンポーネント
  • 対象読者: 技術チーム、経営幹部、外部ステークホルダー

2. データの取得

データウェアハウスが接続済みで、クエリが必要な場合:

  1. クエリを作成して実行する
  2. 結果をpandas DataFrameに読み込む

データが貼り付けまたはアップロードされた場合:

  1. データをpandas DataFrameにパースする
  2. 必要に応じてクリーニングと前処理を行う(型変換、null値の処理など)

会話内の過去の分析からのデータの場合:

  1. 既存のデータを参照する

3. チャートの種類の選択

ユーザーがチャートの種類を指定していない場合は、データと目的に基づいて推奨します:

データの関係性 推奨チャート
時系列のトレンド 折れ線グラフ
カテゴリ間の比較 棒グラフ(カテゴリが多い場合は横棒グラフ)
全体に対する構成比 積み上げ棒グラフまたは面グラフ(6カテゴリ未満の場合を除き、円グラフは避ける)
値の分布 ヒストグラムまたは箱ひげ図
2変数間の相関 散布図
2変数の時系列比較 二軸折れ線グラフまたはグループ棒グラフ
地理データ コロプレスマップ
ランキング 横棒グラフ
フローまたはプロセス サンキーダイアグラム
関係性のマトリクス ヒートマップ

ユーザーが指定していない場合は、推奨理由を簡潔に説明します。

4. ビジュアライゼーションの生成

目的に応じて、以下のいずれかのライブラリを使用したPythonコードを作成します:

  • matplotlib + seaborn: 静的な出版品質のチャートに最適。デフォルトの選択肢。
  • plotly: インタラクティブなチャート、またはユーザーがインタラクティブ機能を求めている場合に最適。

コードの要件:

import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd

# プロフェッショナルなスタイルを設定
plt.style.use('seaborn-v0_8-whitegrid')
sns.set_palette("husl")

# 適切なサイズでfigureを作成
fig, ax = plt.subplots(figsize=(10, 6))

# [チャート固有のコード]

# 以下は必ず含める:
ax.set_title('明確でわかりやすいタイトル', fontsize=14, fontweight='bold')
ax.set_xlabel('X軸ラベル', fontsize=11)
ax.set_ylabel('Y軸ラベル', fontsize=11)

# 数値を適切にフォーマット
# - パーセント: '0.452' ではなく '45.2%'
# - 通貨: '1200000' ではなく '$1.2M'
# - 大きな数値: '2300' や '1500000' ではなく '2.3K' や '1.5M'

# 不要な装飾を除去
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)

plt.tight_layout()
plt.savefig('chart_name.png', dpi=150, bbox_inches='tight')
plt.show()

5. デザインのベストプラクティスを適用

カラー:

  • 一貫性があり、色覚バリアフリーなパレットを使用する
  • 色は装飾ではなく意味を持たせて使用する
  • コントラストカラーで重要なデータポイントやトレンドを強調する
  • 重要度の低い参照データはグレーアウトする

タイポグラフィ:

  • 指標名だけでなく、インサイトを示す説明的なタイトルをつける (例: 「月別収益」ではなく「収益が前年比23%成長」)
  • 読みやすい軸ラベルをつける(可能であれば90度回転は避ける)
  • 明確さを高める場合は、重要なポイントにデータラベルを表示する

レイアウト:

  • 適切な余白とマージンを確保する
  • データを隠さない位置に凡例を配置する
  • カテゴリは自然な順序がない限り、アルファベット順ではなく値の順にソートする

正確性:

  • 棒グラフのY軸はゼロから始める
  • 明確な注記なしに誤解を招く軸の中断を行わない
  • パネルを比較する場合はスケールを統一する
  • 適切な精度にする(小数点以下10桁は表示しない)

6. 保存と提示

  1. 説明的なファイル名でチャートをPNGとして保存する
  2. ユーザーにチャートを表示する
  3. 修正できるよう、使用したコードを提供する
  4. バリエーションを提案する(別のチャートの種類、別のグループ化、時間範囲のズームなど)

使用例

/create-viz 直近12ヶ月の月別収益を、トレンドを強調した折れ線グラフで表示してください
/create-viz こちらが製品別NPSデータです: [データを貼り付け]。製品をスコア順にランキングした横棒グラフを作成してください。
/create-viz ordersテーブルをクエリして、曜日と時間帯別の注文数をヒートマップで表示してください

ヒント

  • ホバー・ズーム・フィルターなどのインタラクティブなチャートが必要な場合は「インタラクティブ」と指定してください。plotlyを使用します。
  • 大きなフォントと高コントラストが必要な場合は「プレゼンテーション用」と指定してください。
  • 複数のチャートを一度にリクエストできます(例:「2×2グリッドで4つのチャートを作成して...」)。
  • チャートはカレントディレクトリにPNGファイルとして保存されます。
原文(English)を表示

/create-viz - Create Visualizations

If you see unfamiliar placeholders or need to check which tools are connected, see CONNECTORS.md.

Create publication-quality data visualizations using Python. Generates charts from data with best practices for clarity, accuracy, and design.

Usage

/create-viz <data source> [chart type] [additional instructions]

Workflow

1. Understand the Request

Determine:

  • Data source: Query results, pasted data, CSV/Excel file, or data to be queried
  • Chart type: Explicitly requested or needs to be recommended
  • Purpose: Exploration, presentation, report, dashboard component
  • Audience: Technical team, executives, external stakeholders

2. Get the Data

If data warehouse is connected and data needs querying:

  1. Write and execute the query
  2. Load results into a pandas DataFrame

If data is pasted or uploaded:

  1. Parse the data into a pandas DataFrame
  2. Clean and prepare as needed (type conversions, null handling)

If data is from a previous analysis in the conversation:

  1. Reference the existing data

3. Select Chart Type

If the user didn't specify a chart type, recommend one based on the data and question:

Data Relationship Recommended Chart
Trend over time Line chart
Comparison across categories Bar chart (horizontal if many categories)
Part-to-whole composition Stacked bar or area chart (avoid pie charts unless <6 categories)
Distribution of values Histogram or box plot
Correlation between two variables Scatter plot
Two-variable comparison over time Dual-axis line or grouped bar
Geographic data Choropleth map
Ranking Horizontal bar chart
Flow or process Sankey diagram
Matrix of relationships Heatmap

Explain the recommendation briefly if the user didn't specify.

4. Generate the Visualization

Write Python code using one of these libraries based on the need:

  • matplotlib + seaborn: Best for static, publication-quality charts. Default choice.
  • plotly: Best for interactive charts or when the user requests interactivity.

Code requirements:

import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd

# Set professional style
plt.style.use('seaborn-v0_8-whitegrid')
sns.set_palette("husl")

# Create figure with appropriate size
fig, ax = plt.subplots(figsize=(10, 6))

# [chart-specific code]

# Always include:
ax.set_title('Clear, Descriptive Title', fontsize=14, fontweight='bold')
ax.set_xlabel('X-Axis Label', fontsize=11)
ax.set_ylabel('Y-Axis Label', fontsize=11)

# Format numbers appropriately
# - Percentages: '45.2%' not '0.452'
# - Currency: '$1.2M' not '1200000'
# - Large numbers: '2.3K' or '1.5M' not '2300' or '1500000'

# Remove chart junk
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)

plt.tight_layout()
plt.savefig('chart_name.png', dpi=150, bbox_inches='tight')
plt.show()

5. Apply Design Best Practices

Color:

  • Use a consistent, colorblind-friendly palette
  • Use color meaningfully (not decoratively)
  • Highlight the key data point or trend with a contrasting color
  • Grey out less important reference data

Typography:

  • Descriptive title that states the insight, not just the metric (e.g., "Revenue grew 23% YoY" not "Revenue by Month")
  • Readable axis labels (not rotated 90 degrees if avoidable)
  • Data labels on key points when they add clarity

Layout:

  • Appropriate whitespace and margins
  • Legend placement that doesn't obscure data
  • Sorted categories by value (not alphabetically) unless there's a natural order

Accuracy:

  • Y-axis starts at zero for bar charts
  • No misleading axis breaks without clear notation
  • Consistent scales when comparing panels
  • Appropriate precision (don't show 10 decimal places)

6. Save and Present

  1. Save the chart as a PNG file with descriptive name
  2. Display the chart to the user
  3. Provide the code used so they can modify it
  4. Suggest variations (different chart type, different grouping, zoomed time range)

Examples

/create-viz Show monthly revenue for the last 12 months as a line chart with the trend highlighted
/create-viz Here's our NPS data by product: [pastes data]. Create a horizontal bar chart ranking products by score.
/create-viz Query the orders table and create a heatmap of order volume by day-of-week and hour

Tips

  • If you want interactive charts (hover, zoom, filter), mention "interactive" and Claude will use plotly
  • Specify "presentation" if you need larger fonts and higher contrast
  • You can request multiple charts at once (e.g., "create a 2x2 grid of charts showing...")
  • Charts are saved to your current directory as PNG files

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。