mcpField
S
scientific-visualization

scientific-visualization

github.com/hkphysicsデータ・データベース043 回インストール19 週間前に更新
リポジトリ

scientific-visualization について

matplotlib、seaborn、plotlyで論文用の図を作成する研究者向けの可視化スキルです。ジャーナルの書式、色覚に配慮した配色、複数パネルの構成、出力要件を扱います。

主な機能

  1. 01ジャーナル別スタイルとサイズ設定
  2. 02色覚対応パレットとグレースケール確認
  3. 03複数パネルのレイアウト
  4. 04統計グラフと誤差表示
  5. 05出版形式での画像出力

活用シーン

  1. 01論文用の図の作成
  2. 02投稿先ジャーナルに合わせた図の準備
  3. 03既存図の出版基準への調整

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/hkphysics/scientific-agent-skills --skill scientific-visualization

インストール後、Claude Code で/scientific-visualizationを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

assets/
color_palettes.py
nature.mplstyle
presentation.mplstyle
publication.mplstyle
references/
color_palettes.md
journal_requirements.md
matplotlib_examples.md
publication_guidelines.md
scripts/
figure_export.py
style_presets.py

詳細

Scientific Visualization

概要

科学可視化では、データを明瞭で正確な論文掲載用の図に変換します。複数パネルのレイアウト、エラーバー、有意差マーカー、色覚多様性に配慮したカラーパレットを使って、学術誌への投稿に適したプロットを作成します。matplotlib、seaborn、plotlyを使用して、原稿用にPDF/EPS/TIFF形式でエクスポートします。

このスキルを使う場面

次のような場合に、このスキルを使用します。

  • 科学論文用のプロットや可視化を作成する
  • 学術誌への投稿用の図を準備する(Nature、Science、Cell、PLOSなど)
  • 図を色覚多様性に配慮し、誰もが利用しやすいものにする
  • 一貫したスタイルで複数パネルの図を作成する
  • 適切な解像度と形式で図をエクスポートする
  • 特定の出版ガイドラインに従う
  • 既存の図を出版基準に適合するよう改善する
  • カラーとグレースケールのどちらでも使える図を作成する

クイックスタートガイド

出版品質の基本的な図
import matplotlib.pyplot as plt
import numpy as np

# Apply publication style (from scripts/style_presets.py)
from style_presets import apply_publication_style
apply_publication_style('default')

# Create figure with appropriate size (single column = 3.5 inches)
fig, ax = plt.subplots(figsize=(3.5, 2.5))

# Plot data
x = np.linspace(0, 10, 100)
ax.plot(x, np.sin(x), label='sin(x)')
ax.plot(x, np.cos(x), label='cos(x)')

# Proper labeling with units
ax.set_xlabel('Time (seconds)')
ax.set_ylabel('Amplitude (mV)')
ax.legend(frameon=False)

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

# Save in publication formats (from scripts/figure_export.py)
from figure_export import save_publication_figure
save_publication_figure(fig, 'figure1', formats=['pdf', 'png'], dpi=300)
設定済みのスタイルを使用する

assets/ 内のmatplotlibスタイルファイルを使って、学術誌ごとのスタイルを適用します。

import matplotlib.pyplot as plt

# Option 1: Use style file directly
plt.style.use('assets/nature.mplstyle')

# Option 2: Use style_presets.py helper
from style_presets import configure_for_journal
configure_for_journal('nature', figure_width='single')

# Now create figures - they'll automatically match Nature specifications
fig, ax = plt.subplots()
# ... your plotting code ...
seabornでクイックスタート

統計プロットには、出版向けのスタイルを適用したseabornを使用します。

import seaborn as sns
import matplotlib.pyplot as plt
from style_presets import apply_publication_style

# Apply publication style
apply_publication_style('default')
sns.set_theme(style='ticks', context='paper', font_scale=1.1)
sns.set_palette('colorblind')

# Create statistical comparison figure
fig, ax = plt.subplots(figsize=(3.5, 3))
sns.boxplot(data=df, x='treatment', y='response', 
            order=['Control', 'Low', 'High'], palette='Set2', ax=ax)
sns.stripplot(data=df, x='treatment', y='response',
              order=['Control', 'Low', 'High'], 
              color='black', alpha=0.3, size=3, ax=ax)
ax.set_ylabel('Response (μM)')
sns.despine()

# Save figure
from figure_export import save_publication_figure
save_publication_figure(fig, 'treatment_comparison', formats=['pdf', 'png'], dpi=300)

基本原則とベストプラクティス

1. 解像度とファイル形式

重要な要件(詳しくは references/publication_guidelines.md を参照してください):

  • ラスター画像(写真、顕微鏡画像):300~600 DPI
  • 線画(グラフ、プロット):600~1200 DPI、またはベクター形式
  • ベクター形式(推奨):PDF、EPS、SVG
  • ラスター形式:TIFF、PNG(科学データにはJPEGを使用しないでください)

実装:

# Use the figure_export.py script for correct settings
from figure_export import save_publication_figure

# Saves in multiple formats with proper DPI
save_publication_figure(fig, 'myfigure', formats=['pdf', 'png'], dpi=300)

# Or save for specific journal requirements
from figure_export import save_for_journal
save_for_journal(fig, 'figure1', journal='nature', figure_type='combination')
2. 色の選択 — 色覚多様性への配慮

常に色覚多様性に配慮したカラーパレットを使用します(詳しくは references/color_palettes.md を参照してください)。

推奨:岡部伊東パレット(あらゆる種類の色覚特性の人が色を区別できます):

# Option 1: Use assets/color_palettes.py
from color_palettes import OKABE_ITO_LIST, apply_palette
apply_palette('okabe_ito')

# Option 2: Manual specification
okabe_ito = ['#E69F00', '#56B4E9', '#009E73', '#F0E442',
             '#0072B2', '#D55E00', '#CC79A7', '#000000']
plt.rcParams['axes.prop_cycle'] = plt.cycler(color=okabe_ito)

ヒートマップ/連続データの場合:

  • 知覚的に均一なカラーマップを使用します:viridis、plasma、cividis
  • 赤と緑の発散型カラーマップは避けます(代わりに PuOr、RdBu、BrBG を使用します)
  • jet や rainbow のカラーマップは使用しないでください

解釈しやすさを確保するため、図は必ずグレースケールでも確認してください。

3. タイポグラフィとテキスト

フォントのガイドライン(詳しくは references/publication_guidelines.md を参照してください):

  • サンセリフフォント:Arial、Helvetica、Calibri
  • 最終印刷サイズでの最小文字サイズ:
    • 軸ラベル:7~9 pt
    • 目盛りラベル:6~8 pt
    • パネルラベル:8~12 pt(太字)
  • ラベルは文頭のみ大文字にします:「Time (hours)」ではなく「TIME (HOURS)」
  • 単位は必ず括弧内に記載します

実装:

# Set fonts globally
import matplotlib as mpl
mpl.rcParams['font.family'] = 'sans-serif'
mpl.rcParams['font.sans-serif'] = ['Arial', 'Helvetica']
mpl.rcParams['font.size'] = 8
mpl.rcParams['axes.labelsize'] = 9
mpl.rcParams['xtick.labelsize'] = 7
mpl.rcParams['ytick.labelsize'] = 7
4. 図の寸法

学術誌ごとの幅(詳しくは references/journal_requirements.md を参照してください):

  • Nature:1段組 89 mm、2段組 183 mm
  • Science:1段組 55 mm、2段組 175 mm
  • Cell:1段組 85 mm、2段組 178 mm

図のサイズが要件に適合しているか確認します:

from figure_export import check_figure_size

fig = plt.figure(figsize=(3.5, 3))  # 89 mm for Nature
check_figure_size(fig, journal='nature')
5. 複数パネルの図

ベストプラクティス:

  • パネルには太字の文字を付けます:A、B、C(ほとんどの学術誌では大文字、Natureでは小文字)
  • すべてのパネルでスタイルを統一します
  • 可能な場合はパネルの端を揃えます
  • パネル間に十分な余白を設けます

実装例(完全なコードは references/matplotlib_examples.md を参照してください):

from string import ascii_uppercase

fig = plt.figure(figsize=(7, 4))
gs = fig.add_gridspec(2, 2, hspace=0.4, wspace=0.4)

ax1 = fig.add_subplot(gs[0, 0])
ax2 = fig.add_subplot(gs[0, 1])
# ... create other panels ...

# Add panel labels
for i, ax in enumerate([ax1, ax2, ...]):
    ax.text(-0.15, 1.05, ascii_uppercase[i], transform=ax.transAxes,
            fontsize=10, fontweight='bold', va='top')

よくあるタスク

タスク1:投稿用の折れ線グラフを作成する

完全なコードは references/matplotlib_examples.md の例1を参照してください。

主な手順:

  1. 出版向けのスタイルを適用する
  2. 投稿先の学術誌に適した図のサイズを設定する
  3. 色覚多様性に配慮した色を使用する
  4. 適切な形式(SEM、SD、またはCI)でエラーバーを追加する
  5. 単位を付けて軸にラベルを付ける
  6. 不要な軸線を取り除く
  7. ベクター形式で保存する

信頼区間を自動で表示するseabornの使用方法:

import seaborn as sns
fig, ax = plt.subplots(figsize=(5, 3))
sns.lineplot(data=timeseries, x='time', y='measurement',
             hue='treatment', errorbar=('ci', 95), 
             markers=True, ax=ax)
ax.set_xlabel('Time (hours)')
ax.set_ylabel('Measurement (AU)')
sns.despine()
タスク2:複数パネルの図を作成する

完全なコードは references/matplotlib_examples.md の例2を参照してください。

主な手順:

  1. 柔軟なレイアウトには GridSpec を使用する
  2. パネル間でスタイルを統一する
  3. 太字のパネルラベル(A、B、Cなど)を付ける
  4. 関連するパネルを揃える
  5. 最終サイズでテキストがすべて読みやすいことを確認する
Task 3: 適切なカラーマップでヒートマップを作成する

完全なコードは references/matplotlib_examples.md の例 4 を参照してください。

主な手順:

  1. 知覚的に一様なカラーマップ(viridis、plasma、cividis)を使用する
  2. ラベル付きのカラーバーを含める
  3. 発散型データには、色覚異常に配慮した発散型マップ(RdBu_r、PuOr)を使用する
  4. 発散型マップには適切な中心値を設定する
  5. グレースケールでの見え方を確認する

相関行列に seaborn を使用する場合:

import seaborn as sns
fig, ax = plt.subplots(figsize=(5, 4))
corr = df.corr()
mask = np.triu(np.ones_like(corr, dtype=bool))
sns.heatmap(corr, mask=mask, annot=True, fmt='.2f',
            cmap='RdBu_r', center=0, square=True,
            linewidths=1, cbar_kws={'shrink': 0.8}, ax=ax)
Task 4: 特定のジャーナル向けに図を準備する

ワークフロー:

  1. ジャーナルの要件を確認する: references/journal_requirements.md
  2. ジャーナル向けに matplotlib を設定する:
    from style_presets import configure_for_journal
    configure_for_journal('nature', figure_width='single')
    
  3. 図を作成する(自動的に正しいサイズになります)
  4. ジャーナルの仕様に合わせて書き出す:
    from figure_export import save_for_journal
    save_for_journal(fig, 'figure1', journal='nature', figure_type='line_art')
    
Task 5: 既存の図を出版基準に適合させる

チェックリスト方式(完全なチェックリストは references/publication_guidelines.md にあります):

  1. 解像度を確認する: DPI がジャーナルの要件を満たしているか検証する
  2. ファイル形式を確認する: プロットにはベクター形式、画像には TIFF/PNG を使用する
  3. 色を確認する: 色覚異常に配慮されていることを確認する
  4. フォントを確認する: 最終サイズで最小 6〜7 pt、サンセリフ体にする
  5. ラベルを確認する: すべての軸に単位付きのラベルがあるか確認する
  6. サイズを確認する: ジャーナルの段組み幅に一致しているか確認する
  7. グレースケールを確認する: 色がなくても図が理解できるか確認する
  8. チャートジャンクを取り除く: 不要なグリッド、3D 効果、影を取り除く
Task 6: 色覚異常に配慮した可視化を作成する

方針:

  1. assets/color_palettes.py にある承認済みパレットを使用する
  2. 冗長な符号化(線種、マーカー、パターン)を追加する
  3. 色覚シミュレーターでテストする
  4. グレースケールへの対応を確認する

例:

from color_palettes import apply_palette
import matplotlib.pyplot as plt

apply_palette('okabe_ito')

# Add redundant encoding beyond color
line_styles = ['-', '--', '-.', ':']
markers = ['o', 's', '^', 'v']

for i, (data, label) in enumerate(datasets):
    plt.plot(x, data, linestyle=line_styles[i % 4],
             marker=markers[i % 4], label=label)

統計的厳密性

必ず含めるもの:

  • 誤差線(SD、SEM、または CI。どれを使ったかはキャプションに明記する)
  • 図またはキャプション内のサンプルサイズ(n)
  • 統計的有意性の記号(、、)
  • 可能な場合は要約統計量だけでなく個々のデータ点

統計を含む例:

# Show individual points with summary statistics
ax.scatter(x_jittered, individual_points, alpha=0.4, s=8)
ax.errorbar(x, means, yerr=sems, fmt='o', capsize=3)

# Mark significance
ax.text(1.5, max_y * 1.1, '***', ha='center', fontsize=8)

異なるプロットライブラリでの作業

Matplotlib
  • 出版向けの細部を最も細かく制御できる
  • 複雑な複数パネルの図に最適
  • 一貫した書式のために、提供されているスタイルファイルを使用する
  • 豊富な例は references/matplotlib_examples.md を参照
Seaborn

Seaborn は、matplotlib の上に構築された、統計グラフィックス向けの高レベルなデータセット指向のインターフェースです。matplotlib によるカスタマイズと完全な互換性を保ちながら、少ないコードで出版品質の統計的可視化を作成することに優れています。

科学的可視化における主な利点:

  • 統計量の自動推定と信頼区間
  • 複数パネルの図(ファセット)に標準で対応
  • デフォルトで色覚異常に配慮したパレット
  • pandas DataFrame を使用するデータセット指向の API
  • 変数から視覚的属性へのセマンティックマッピング
出版スタイルのクイックスタート

まず matplotlib の出版スタイルを適用し、その後で seaborn を設定してください:

import seaborn as sns
import matplotlib.pyplot as plt
from style_presets import apply_publication_style

# Apply publication style
apply_publication_style('default')

# Configure seaborn for publication
sns.set_theme(style='ticks', context='paper', font_scale=1.1)
sns.set_palette('colorblind')  # Use colorblind-safe palette

# Create figure
fig, ax = plt.subplots(figsize=(3.5, 2.5))
sns.scatterplot(data=df, x='time', y='response', 
                hue='treatment', style='condition', ax=ax)
sns.despine()  # Remove top and right spines
出版向けによく使うプロットの種類

統計比較:

# Box plot with individual points for transparency
fig, ax = plt.subplots(figsize=(3.5, 3))
sns.boxplot(data=df, x='treatment', y='response', 
            order=['Control', 'Low', 'High'], palette='Set2', ax=ax)
sns.stripplot(data=df, x='treatment', y='response',
              order=['Control', 'Low', 'High'], 
              color='black', alpha=0.3, size=3, ax=ax)
ax.set_ylabel('Response (μM)')
sns.despine()

分布の分析:

# Violin plot with split comparison
fig, ax = plt.subplots(figsize=(4, 3))
sns.violinplot(data=df, x='timepoint', y='expression',
               hue='treatment', split=True, inner='quartile', ax=ax)
ax.set_ylabel('Gene Expression (AU)')
sns.despine()

相関行列:

# Heatmap with proper colormap and annotations
fig, ax = plt.subplots(figsize=(5, 4))
corr = df.corr()
mask = np.triu(np.ones_like(corr, dtype=bool))  # Show only lower triangle
sns.heatmap(corr, mask=mask, annot=True, fmt='.2f',
            cmap='RdBu_r', center=0, square=True,
            linewidths=1, cbar_kws={'shrink': 0.8}, ax=ax)
plt.tight_layout()

信頼帯付きの時系列:

# Line plot with automatic CI calculation
fig, ax = plt.subplots(figsize=(5, 3))
sns.lineplot(data=timeseries, x='time', y='measurement',
             hue='treatment', style='replicate',
             errorbar=('ci', 95), markers=True, dashes=False, ax=ax)
ax.set_xlabel('Time (hours)')
ax.set_ylabel('Measurement (AU)')
sns.despine()
seaborn による複数パネルの図

FacetGrid による自動ファセット:

# Create faceted plot
g = sns.relplot(data=df, x='dose', y='response',
                hue='treatment', col='cell_line', row='timepoint',
                kind='line', height=2.5, aspect=1.2,
                errorbar=('ci', 95), markers=True)
g.set_axis_labels('Dose (μM)', 'Response (AU)')
g.set_titles('{row_name} | {col_name}')
sns.despine()

# Save with correct DPI
from figure_export import save_publication_figure
save_publication_figure(g.figure, 'figure_facets', 
                       formats=['pdf', 'png'], dpi=300)

seaborn と matplotlib のサブプロットの組み合わせ:

# Create custom multi-panel layout
fig, axes = plt.subplots(2, 2, figsize=(7, 6))

# Panel A: Scatter with regression
sns.regplot(data=df, x='predictor', y='response', ax=axes[0, 0])
axes[0, 0].text(-0.15, 1.05, 'A', transform=axes[0, 0].transAxes,
                fontsize=10, fontweight='bold')

# Panel B: Distribution comparison
sns.violinplot(data=df, x='group', y='value', ax=axes[0, 1])
axes[0, 1].text(-0.15, 1.05, 'B', transform=axes[0, 1].transAxes,
                fontsize=10, fontweight='bold')

# Panel C: Heatmap
sns.heatmap(correlation_data, cmap='viridis', ax=axes[1, 0])
axes[1, 0].text(-0.15, 1.05, 'C', transform=axes[1, 0].transAxes,
                fontsize=10, fontweight='bold')

# Panel D: Time series
sns.lineplot(data=timeseries, x='time', y='signal', 
             hue='condition', ax=axes[1, 1])
axes[1, 1].text(-0.15, 1.05, 'D', transform=axes[1, 1].transAxes,
                fontsize=10, fontweight='bold')

plt.tight_layout()
sns.despine()
出版向けのカラーパレット

Seaborn には、色覚異常に配慮したパレットがいくつか含まれています:

# Use built-in colorblind palette (recommended)
sns.set_palette('colorblind')

# Or specify custom colorblind-safe colors (Okabe-Ito)
okabe_ito = ['#E69F00', '#56B4E9', '#009E73', '#F0E442',
             '#0072B2', '#D55E00', '#CC79A7', '#000000']
sns.set_palette(okabe_ito)

# For heatmaps and continuous data
sns.heatmap(data, cmap='viridis')  # Perceptually uniform
sns.heatmap(corr, cmap='RdBu_r', center=0)  # Diverging, centered
軸レベル関数と図レベル関数の選択

軸レベル関数(例: scatterplot、boxplot、heatmap):

  • 独自の複数パネルレイアウトを構築する場合に使用する
  • 正確な配置のために ax= パラメーターを受け付ける
  • matplotlib のサブプロットとの統合性が高い
  • 図の構成をより細かく制御できる
fig, ax = plt.subplots(figsize=(3.5, 2.5))
sns.scatterplot(data=df, x='x', y='y', hue='group', ax=ax)

図レベル関数(例: relplot、catplot、displot):

  • カテゴリ変数による自動ファセットに使用する
  • 一貫したスタイルで完全な図を作成する
  • 探索的分析に最適
  • サイズ指定には height と aspect を使用する
g = sns.relplot(data=df, x='x', y='y', col='category', kind='scatter')
Seaborn による統計的な厳密性

Seaborn は不確実性を自動的に計算して表示します:

# Line plot: shows mean ± 95% CI by default
sns.lineplot(data=df, x='time', y='value', hue='treatment',
             errorbar=('ci', 95))  # Can change to 'sd', 'se', etc.

# Bar plot: shows mean with bootstrapped CI
sns.barplot(data=df, x='treatment', y='response',
            errorbar=('ci', 95), capsize=0.1)

# Always specify error type in figure caption:
# "Error bars represent 95% confidence intervals"
論文掲載に適した Seaborn 図を作成するためのベストプラクティス
  1. まず論文掲載用のテーマを設定します:

    sns.set_theme(style='ticks', context='paper', font_scale=1.1)
    
  2. 色覚多様性に配慮したパレットを使用します:

    sns.set_palette('colorblind')
    
  3. 不要な要素を取り除きます:

    sns.despine()  # Remove top and right spines
    
  4. 図のサイズを適切に調整します:

    # Axes-level: use matplotlib figsize
    fig, ax = plt.subplots(figsize=(3.5, 2.5))
    
    # Figure-level: use height and aspect
    g = sns.relplot(..., height=3, aspect=1.2)
    
  5. 可能な場合は個々のデータポイントを表示します:

    sns.boxplot(...)  # Summary statistics
    sns.stripplot(..., alpha=0.3)  # Individual points
    
  6. 単位を含む適切なラベルを付けます:

    ax.set_xlabel('Time (hours)')
    ax.set_ylabel('Expression (AU)')
    
  7. 適切な解像度で出力します:

    from figure_export import save_publication_figure
    save_publication_figure(fig, 'figure_name', 
                           formats=['pdf', 'png'], dpi=300)
    
Seaborn の高度なテクニック

探索的分析のためのペアごとの関係:

# Quick overview of all relationships
g = sns.pairplot(data=df, hue='condition', 
                 vars=['gene1', 'gene2', 'gene3'],
                 corner=True, diag_kind='kde', height=2)

階層的クラスタリングヒートマップ:

# Cluster samples and features
g = sns.clustermap(expression_data, method='ward', 
                   metric='euclidean', z_score=0,
                   cmap='RdBu_r', center=0, 
                   figsize=(10, 8), 
                   row_colors=condition_colors,
                   cbar_kws={'label': 'Z-score'})

周辺分布を含む同時分布:

# Bivariate distribution with context
g = sns.jointplot(data=df, x='gene1', y='gene2',
                  hue='treatment', kind='scatter',
                  height=6, ratio=4, marginal_kws={'kde': True})
Seaborn でよくある問題と解決策

問題:凡例がプロット領域の外にある

g = sns.relplot(...)
g._legend.set_bbox_to_anchor((0.9, 0.5))

問題:ラベルが重なっている

plt.xticks(rotation=45, ha='right')
plt.tight_layout()

問題:最終サイズで文字が小さすぎる

sns.set_context('paper', font_scale=1.2)  # Increase if needed
追加リソース

Seaborn の詳細については、以下を参照してください:

  • skills/seaborn/SKILL.md - Seaborn の包括的なドキュメント
  • skills/seaborn/references/examples.md - 実践的な使用例
  • skills/seaborn/references/function_reference.md - API リファレンス全文
  • skills/seaborn/references/objects_interface.md - 最新の宣言型 API
Plotly
  • 探索用のインタラクティブな図
  • 論文掲載用に静的画像を出力
  • 論文掲載に適した品質に設定:
fig.update_layout(
    font=dict(family='Arial, sans-serif', size=10),
    plot_bgcolor='white',
    # ... see matplotlib_examples.md Example 8
)
fig.write_image('figure.png', scale=3)  # scale=3 gives ~300 DPI

リソース

References ディレクトリ

詳細情報が必要な場合に読み込んでください:

  • publication_guidelines.md:包括的なベストプラクティス

    • 解像度とファイル形式の要件
    • タイポグラフィのガイドライン
    • レイアウトと構成のルール
    • 統計的な厳密性に関する要件
    • 論文掲載用チェックリストの全文
  • color_palettes.md:色の使用ガイド

    • RGB 値を含む、色覚多様性に配慮したパレットの仕様
    • 逐次型および発散型カラーマップの推奨事項
    • アクセシビリティのテスト手順
    • 分野別パレット(ゲノミクス、顕微鏡法)
  • journal_requirements.md:学術誌固有の仕様

    • 出版社ごとの技術要件
    • ファイル形式と DPI の仕様
    • 図の寸法要件
    • クイックリファレンステーブル
  • matplotlib_examples.md:実践的なコード例

    • 動作する完全な例を 10 件掲載
    • 折れ線グラフ、棒グラフ、ヒートマップ、複数パネルの図
    • 学術誌固有の図の例
    • 各ライブラリ(matplotlib、seaborn、plotly)のヒント
Scripts ディレクトリ

自動化には次のヘルパースクリプトを使用してください:

  • figure_export.py:出力ユーティリティ

    • save_publication_figure():適切な DPI で複数の形式に保存
    • save_for_journal():学術誌固有の要件を自動的に適用
    • check_figure_size():寸法が学術誌の仕様を満たしているか確認
    • 直接実行:例を確認するには python scripts/figure_export.py を実行します
  • style_presets.py:事前設定済みのスタイル

    • apply_publication_style():プリセットスタイル(default、nature、science、cell)を適用
    • set_color_palette():パレットをすばやく切り替え
    • configure_for_journal():学術誌向けの設定を 1 コマンドで適用
    • 直接実行:例を確認するには python scripts/style_presets.py を実行します
Assets ディレクトリ

図には次のファイルを使用してください:

  • color_palettes.py:インポート可能な色定義

    • 推奨パレットをすべて Python 定数として収録
    • apply_palette() ヘルパー関数
    • ノートブックやスクリプトに直接インポート可能
  • Matplotlib スタイルファイル:plt.style.use() と併用

    • publication.mplstyle:一般的な論文掲載品質
    • nature.mplstyle:Nature の仕様
    • presentation.mplstyle:ポスターやスライド向けの大きなフォント

ワークフローの概要

出版用図表を作成するための推奨ワークフロー:

  1. 計画: 対象のジャーナル、図の種類、内容を決定する
  2. 設定: ジャーナルに適したスタイルを適用する
    from style_presets import configure_for_journal
    configure_for_journal('nature', 'single')
    
  3. 作成: 適切なラベル、色、統計情報を含めて図を作成する
  4. 検証: サイズ、フォント、色、アクセシビリティを確認する
    from figure_export import check_figure_size
    check_figure_size(fig, journal='nature')
    
  5. 書き出し: 必要な形式で保存する
    from figure_export import save_for_journal
    save_for_journal(fig, 'figure1', 'nature', 'combination')
    
  6. レビュー: 原稿の文脈で最終サイズの表示を確認する

避けるべきよくある落とし穴

  1. フォントが小さすぎる: 最終サイズで印刷すると文字が読めない
  2. JPEG形式: グラフやプロットには決してJPEGを使用しない(アーティファクトが発生する)
  3. 赤と緑の色: 男性の約8%は区別できない
  4. 低解像度: 出版物で図がピクセル化する
  5. 単位の欠落: 軸には必ず単位を付けてラベル付けする
  6. 3D効果: 知覚を歪めるため、完全に避ける
  7. チャートジャンク: 不要なグリッド線や装飾を取り除く
  8. 切り詰められた軸: 科学的に正当な理由がない限り、棒グラフは0から始める
  9. スタイルの不統一: 同じ原稿内の図で、フォントや色が異なる
  10. 誤差線の欠如: 不確かさは必ず示す

最終チェックリスト

図を提出する前に、以下を確認してください:

  • 解像度がジャーナルの要件を満たしている(300 DPI以上)
  • ファイル形式が正しい(プロットはベクター、画像はTIFF)
  • 図のサイズがジャーナルの仕様に一致している
  • すべての文字が最終サイズで読める(6 pt以上)
  • 色が色覚多様性に配慮している
  • 図がグレースケールでも機能する
  • すべての軸に単位付きのラベルがある
  • 誤差線があり、キャプションでその定義を示している
  • パネルラベルがあり、一貫している
  • チャートジャンクや3D効果がない
  • すべての図でフォントが統一されている
  • 統計的有意性が明確に示されている
  • 凡例が明確で完全である

このスキルを使用して、科学的な図が最高水準の出版基準を満たしつつ、すべての読者にとって分かりやすいものになるよう確認してください。

コメント