D3 Visualization Guideのロゴ

D3 Visualization Guide

コミュニティ
wentorai
d3-visualization-guide

Guide to D3.js for building custom interactive data visualizations

概要

公開者wentorai
リポジトリresearch-plugins
スキル名d3-visualization-guide
スター
294
フォーク
42
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    wentoraiがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「D3 Visualization Guide」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/wentorai/research-plugins/tree/main/skills/analysis/dataviz/d3-visualization-guide
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wentorai/research-plugins.git /tmp/research-plugins
mkdir -p .claude/skills
cp -r /tmp/research-plugins/skills/analysis/dataviz/d3-visualization-guide .claude/skills/d3-visualization-guide
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでD3 Visualization Guideを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にD3 Visualization Guideを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、D3 Visualization Guideは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

D3.js Visualization Guide

Overview

D3.js (Data-Driven Documents) is the most powerful and flexible JavaScript library for producing dynamic, interactive data visualizations in web browsers. With over 112K stars on GitHub, D3 has become the de facto standard for custom data visualization on the web. It uses HTML, SVG, and CSS to bring data to life, giving researchers full control over the final visual output.

Unlike higher-level charting libraries, D3 operates at the level of individual SVG elements and data bindings, which means researchers can create entirely bespoke visualizations tailored to their specific datasets and publication requirements. This makes it particularly valuable for academic work where standard chart types may not adequately represent complex research findings.

D3 provides a comprehensive ecosystem of modules covering everything from scales and axes to geographic projections, force-directed layouts, and hierarchical data structures. The library follows a functional, composable design that allows researchers to combine modules as needed for their specific visualization tasks.

Core Concepts for Research Visualizations

D3 revolves around the concept of binding data to DOM elements and applying data-driven transformations. The key patterns every researcher should understand are selections, data joins, scales, and axes.

Data Binding and Selections

javascript
// Load research data from CSV
const data = await d3.csv("experiment_results.csv", d => ({
  condition: d.condition,
  measurement: +d.measurement,
  error: +d.standard_error
}));

// Create an SVG container
const svg = d3.select("#chart")
  .append("svg")
  .attr("width", 800)
  .attr("height", 500);

// Binddata to elements using the enter-update-exit pattern
svg.selectAll("circle")
  .data(data)
  .join("circle")
  .attr("cx", d => xScale(d.condition))
  .attr("cy", d => yScale(d.measurement))
  .attr("r", 5)
  .attr("fill", "#3B82F6");

Scales and Axes

javascript
// Linear scale for continuous measurements
const yScale = d3.scaleLinear()
  .domain([0, d3.max(data, d => d.measurement)])
  .range([height - margin.bottom, margin.top]);

// Band scale for categorical conditions
const xScale = d3.scaleBand()
  .domain(data.map(d => d.condition))
  .range([margin.left, width - margin.right])
  .padding(0.3);

// Add axes with proper formatting
svg.append("g")
  .attr("transform", `translate(0,${height - margin.bottom})`)
  .call(d3.axisBottom(xScale));

svg.append("g")
  .attr("transform", `translate(${margin.left},0)`)
  .call(d3.axisLeft(yScale).tickFormat(d3.format(".2f")));

Publication-Quality Scientific Charts

Error Bar Plot for Experimental Results

javascript
function createErrorBarPlot(data, container) {
  const margin = { top: 40, right: 30, bottom: 60, left: 70 };
  const width = 700 - margin.left - margin.right;
  const height = 450 - margin.top - margin.bottom;

  const svg = d3.select(container)
    .append("svg")
    .attr("width", width + margin.left + margin.right)
    .attr("height", height + margin.top + margin.bottom)
    .append("g")
    .attr("transform", `translate(${margin.left},${margin.top})`);

  const x = d3.scaleBand()
    .domain(data.map(d => d.group))
    .range([0, width])
    .padding(0.4);

  const y = d3.scaleLinear()
    .domain([0, d3.max(data, d => d.mean + d.sem) * 1.15])
    .range([height, 0]);

  // Draw bars
  svg.selectAll(".bar")
    .data(data)
    .join("rect")
    .attr("class", "bar")
    .attr("x", d => x(d.group))
    .attr("y", d => y(d.mean))
    .attr("width", x.bandwidth())
    .attr("height", d => height - y(d.mean))
    .attr("fill", (d, i) => d3.schemeTableau10[i]);

  // Draw error bars
  svg.selectAll(".error-line")
    .data(data)
    .join("line")
    .attr("x1", d => x(d.group) + x.bandwidth() / 2)
    .attr("x2", d => x(d.group) + x.bandwidth() / 2)
    .attr("y1", d => y(d.mean - d.sem))
    .attr("y2", d => y(d.mean + d.sem))
    .attr("stroke", "#333")
    .attr("stroke-width", 1.5);

  // Error bar caps
  const capWidth = 10;
  ["top", "bottom"].forEach(pos => {
    svg.selectAll(`.cap-${pos}`)
      .data(data)
      .join("line")
      .attr("x1", d => x(d.group) + x.bandwidth() / 2 - capWidth)
      .attr("x2", d => x(d.group) + x.bandwidth() / 2 + capWidth)
      .attr("y1", d => y(d.mean + (pos === "top" ? d.sem : -d.sem)))
      .attr("y2", d => y(d.mean + (pos === "top" ? d.sem : -d.sem)))
      .attr("stroke", "#333")
      .attr("stroke-width", 1.5);
  });

  // Axes
  svg.append("g")
    .attr("transform", `translate(0,${height})`)
    .call(d3.axisBottom(x))
    .selectAll("text")
    .style("font-size", "12px");

  svg.append("g")
    .call(d3.axisLeft(y))
    .selectAll("text")
    .style("font-size", "12px");
}

Heatmap for Correlation Matrices

javascript
function createCorrelationHeatmap(matrix, labels, container) {
  const size = 500;
  const cellSize = size / labels.length;

  const colorScale = d3.scaleSequential(d3.interpolateRdBu)
    .domain([1, -1]);

  const svg = d3.select(container)
    .append("svg")
    .attr("width", size + 120)
    .attr("height", size + 120);

  const g = svg.append("g")
    .attr("transform", "translate(100, 20)");

  // Draw cells
  labels.forEach((rowLabel, i) => {
    labels.forEach((colLabel, j) => {
      g.append("rect")
        .attr("x", j * cellSize)
        .attr("y", i * cellSize)
        .attr("width", cellSize - 1)
        .attr("height", cellSize - 1)
        .attr("fill", colorScale(matrix[i][j]))
        .append("title")
        .text(`${rowLabel} vs ${colLabel}: ${matrix[i][j].toFixed(3)}`);

      g.append("text")
        .attr("x", j * cellSize + cellSize / 2)
        .attr("y", i * cellSize + cellSize / 2)
        .attr("text-anchor", "middle")
        .attr("dominant-baseline", "central")
        .style("font-size", "10px")
        .text(matrix[i][j].toFixed(2));
    });
  });

  // Row and column labels
  g.selectAll(".row-label")
    .data(labels)
    .join("text")
    .attr("x", -8)
    .attr("y", (d, i) => i * cellSize + cellSize / 2)
    .attr("text-anchor", "end")
    .attr("dominant-baseline", "central")
    .style("font-size", "11px")
    .text(d => d);
}

Interactive Techniques for Research Presentations

D3 excels at adding interactivity to visualizations, which is valuable for research presentations, supplementary materials, and data exploration during analysis.

Tooltips and Hover Effects

javascript
// Create a tooltip div
const tooltip = d3.select("body").append("div")
  .attr("class", "tooltip")
  .style("position", "absolute")
  .style("background", "rgba(0,0,0,0.8)")
  .style("color", "#fff")
  .style("padding", "8px 12px")
  .style("border-radius", "4px")
  .style("font-size", "12px")
  .style("pointer-events", "none")
  .style("opacity", 0);

// Attach to data points
svg.selectAll("circle")
  .on("mouseover", (event, d) => {
    tooltip.transition().duration(200).style("opacity", 1);
    tooltip.html(
      `<strong>${d.sample_id}</strong><br/>` +
      `Value: ${d.measurement.toFixed(3)}<br/>` +
      `p-value: ${d.pvalue.toExponential(2)}`
    )
    .style("left", (event.pageX + 12) + "px")
    .style("top", (event.pageY - 28) + "px");
  })
  .on("mouseout", () => {
    tooltip.transition().duration(300).style("opacity", 0);
  });

Zoom and Pan for Large Datasets

javascript
const zoom = d3.zoom()
  .scaleExtent([1, 20])
  .on("zoom", (event) => {
    chartGroup.attr("transform", event.transform);
  });

svg.call(zoom);

Exporting for Publications

When preparing figures for journal submissions, D3 SVG output can be exported directly to vector formats.

javascript
// Extract SVG markup for saving
function exportSVG(svgElement) {
  const serializer = new XMLSerializer();
  const svgString = serializer.serializeToString(svgElement);
  const blob = new Blob([svgString], { type: "image/svg+xml" });
  const url = URL.createObjectURL(blob);

  const link = document.createElement("a");
  link.href = url;
  link.download = "figure.svg";
  link.click();
  URL.revokeObjectURL(url);
}

Researchers can then convert SVG to PDF or EPS using tools like Inkscape or cairosvg for submission to journals that require specific formats.

References

よくある質問

AIスキル「D3 Visualization Guide」では何ができますか?

Guide to D3.js for building custom interactive data visualizations

TypingMindでD3 Visualization Guideを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。D3 Visualization Guideはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにD3 Visualization Guideをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/wentorai/research-plugins/tree/main/skills/analysis/dataviz/d3-visualization-guideを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

D3 Visualization Guideを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

D3 Visualization Guideで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもD3 Visualization Guideを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「D3 Visualization Guide」は無料ですか?

はい。wentoraiがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇