mcpField
S
scientific-publication

scientific-publication

github.com/delphine-l设计与 UI2249 次安装24 周前更新
代码仓库

关于 scientific-publication

面向研究人员的科学图表优化 Skill,指导根据反馈反复改进图表,并兼顾可读性、布局和发表要求。附有出版规范等参考文档。

主要功能

  1. 01系统化图表优化流程
  2. 02图表类型与清晰度指导
  3. 03多面板布局方案比较
  4. 04修正标注及内容溢出
  5. 05发表前检查清单
  6. 06配套出版参考资料

适用场景

  1. 01根据审稿意见修改图表
  2. 02减少密集图表的视觉杂乱
  3. 03比较横向与纵向布局
  4. 04投稿前检查图表

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/delphine-l/claude_global --skill scientific-publication

安装后在 Claude Code 中输入/scientific-publication确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

methodological-transparency.md
multi-study-results.md
overleaf-packages.md
publication-standards.md

详细介绍

科学出版物图表优化

基于用户反馈和出版要求,通过迭代优化系统改进科学图表的专家指南。

此目录中的支持文件:

何时使用此技能

  • 根据审稿人或合作者的反馈改进图表
  • 优化图表的清晰度和可读性
  • 确保所有图表元素都在边界范围内
  • 在不同布局方案之间进行选择(水平面板或垂直面板)
  • 为高影响力出版物准备图表

图表迭代优化工作流

标准优化顺序

改进出版物图表时,请遵循以下系统化方法:

1. 找出核心问题

Examples:
- "Violin plots look distorted on log scale"
- "P-values are cut off at the top"
- "Too much visual clutter, hard to see the data"
- "Text overlaps with data points"

2. 修正可视化类型/方法

# Example: Replace inappropriate plot type
# Before: Violin plot on log scale (distorted)
ax.violinplot(data)
ax.set_yscale('log')

# After: Boxplot on log scale (accurate)
ax.boxplot(data)
ax.set_yscale('log')

3. 提高清晰度 系统地调整元素尺寸:

# Point sizes: Reduce for dense data
# Start: s=60 (exploratory)
# End: s=25 (publication)
ax.scatter(..., s=25, alpha=0.5)

# Line widths: Thinner reduces clutter
# Start: linewidth=2.5
# End: linewidth=1.5
ax.plot(..., linewidth=1.5)

# Text sizes: Prevent overlap
# Start: fontsize=10-12
# End: fontsize=8-9
ax.text(..., fontsize=8)

# Error bar caps: Keep readable
ax.errorbar(..., capsize=5)

4. 测试不同布局方案

# Option A: Side-by-side panels
fig, axes = plt.subplots(1, 2, figsize=(16, 7))
# Pros: Direct left-right comparison
# Cons: Smaller individual panels

# Option B: Stacked vertically
fig, axes = plt.subplots(2, 1, figsize=(10, 14))
# Pros: Larger individual panels, easier to read details
# Cons: Harder to compare across panels

# Decision: Let user feedback guide choice
# Generate both, ask which is clearer

5. 优化元素位置 确保所有标注都在绘图区范围内:

# Calculate safe positioning
y_max = max([d.max() for d in data_list])
y_min = min([d.min() for d in data_list])

# Position annotations WITHIN bounds
y_pos = y_max * 0.92  # 92%, not 105% (which goes outside)

# Set explicit limits with headroom
ax.set_ylim(y_min * 0.95 if y_min > 0 else y_min - 5,
            y_max * 1.05)
出版物图表检查清单

定稿前请使用此检查清单:

  • 图表类型适合数据分布(对数刻度上不使用小提琴图)
  • 所有文字清晰可读,符合出版尺寸要求(至少 8-10 pt)
  • 统计标注清晰可见,且位于绘图区范围内
  • 图例清晰,不会遮挡数据
  • 坐标轴标签描述明确,并标注单位
  • 配色方案适合色觉障碍者
  • 线宽均衡(不太粗也不太细)
  • 点大小经过优化(清晰可见,且不会相互重叠)
  • DPI 足够,符合出版要求(至少 300)
  • 已测试布局(适用时尝试水平和垂直布局)
  • 文件格式符合出版要求(PNG、PDF 或 SVG)

常见优化模式

模式 1:简化密集图表

问题:过多视觉元素相互争夺注意力

解决步骤:

  1. 减小点大小(60 -> 25)
  2. 减小线宽(2.5 -> 1.5)
  3. 提高透明度(alpha=0.8 -> 0.5)
  4. 减小字体大小(10 -> 8)
  5. 移除网格线或调淡网格线(alpha=0.3)

优化前后测试:生成两个版本并进行比较

模式 2:修复溢出问题

问题:标注、图例或标签被截断

解决方案:

# 1. Adjust annotation positions
y_pos = y_max * 0.92  # Within bounds

# 2. Use bbox_inches='tight' when saving
plt.savefig('figure.png', dpi=300, bbox_inches='tight')

# 3. Explicitly set limits
ax.set_ylim(min_val * 0.95, max_val * 1.05)

# 4. Move legend outside plot area
ax.legend(bbox_to_anchor=(1.05, 1), loc='upper left')

# 5. Reduce text size
ax.text(..., fontsize=8)  # Down from 10
模式 3:优化多面板布局

尝试两种方向:

# Version 1: Horizontal (side-by-side)
fig, axes = plt.subplots(1, 2, figsize=(16, 7))
plt.savefig('fig_horizontal.png', dpi=300, bbox_inches='tight')

# Version 2: Vertical (stacked)
fig, axes = plt.subplots(2, 1, figsize=(10, 14))
plt.savefig('fig_vertical.png', dpi=300, bbox_inches='tight')

# Present both to user, ask which is clearer

选择标准:

  • 水平布局:更适合直接比较不同面板
  • 垂直布局:更适合需要更多空间的面板
  • 用户场景:期刊栏宽、演示幻灯片等
模式 4:迭代调整统计标注

常见问题:P 值位于绘图区之外,或与数据重叠

解决方案:

# Calculate data range first
all_data = [data_dual, data_prialt]  # All datasets in plot
y_max = max([d.max() for d in all_data if len(d) > 0])

# Position relative to actual data, not theoretical maximum
for i, (x_pos, comparison) in enumerate(comparisons):
    stat, pval = stats.mannwhitneyu(...)

    # Safe positioning
    y_annotation = y_max * 0.92  # Below the top

    # Format text
    if pval < 0.001:
        text = 'p < 0.001***'
    elif pval < 0.01:
        text = 'p < 0.01**'
    elif pval < 0.05:
        text = 'p < 0.05*'
    else:
        text = f'p = {pval:.3f} ns'

    ax.text(x_pos, y_annotation, text, ha='center', fontsize=9)

# Set explicit limits to ensure annotations fit
ax.set_ylim(0, y_max * 1.05)

优化工作流示例

真实案例:VGP 图 5 的改进过程

  1. 初始版本:4 个类别,使用对数刻度的小提琴图

    • 问题:小提琴图变形,过于复杂
  2. V1 优化:移除小提琴图,保留箱线图

    • 有所改善,但仍有问题
  3. V2 优化:简化为 3 个类别

    • 解读更清晰
  4. V3 优化:缩小点的尺寸(60->25),细化线条(2.5->1.5)

    • 减少了杂乱感
  5. V4 优化:测试纵向和横向布局

    • 横向布局更适合此案例
  6. V5 优化:调整 p 值的位置(y_max 的 105%->92%)

    • 现在所有元素都清晰可见
  7. 最终版:缩小统计信息框中的文字(10->8)

    • 达到出版要求

总迭代次数:优化过程中共完成 7 个版本 结果:图表清晰、准确,达到出版质量

最佳实践

1. 为优化版本编号

进行重大更改时,保留工作版本:

scripts/
  plot_figure.py          # Original
  plot_figure_v2.py       # After major change (layout)
  plot_figure_final.py    # Publication version
2. 并行生成备选方案

测试布局选项时:

# Save both versions
layouts = [
    ((1, 2), (16, 7), 'horizontal'),
    ((2, 1), (10, 14), 'vertical')
]

for (nrows, ncols), figsize, name in layouts:
    fig, axes = plt.subplots(nrows, ncols, figsize=figsize)
    # ... plot data ...
    plt.savefig(f'figure_{name}.png', dpi=300, bbox_inches='tight')
3. 记录每次优化
"""
Figure 5 - Terminal Telomere Presence

Version history:
- v1: Initial 4-category version with violin plots
- v2: Removed violin plots (distortion on log scale)
- v3: Simplified to 3 categories (terminal only)
- v4: Reduced point/line sizes for clarity
- v5: Fixed p-value positioning
- final: Publication ready

Changes from v4 -> v5:
- P-value y-position: 1.05 * y_max -> 0.92 * y_max
- Added explicit y-axis limits: (y_min*0.95, y_max*1.05)
- Ensures all annotations visible within plot bounds
"""
4. 在关键节点征求反馈

不要在没有反馈的情况下反复迭代:

  • 修复重大问题后(图表类型错误):展示给用户
  • 调整布局后(横向布局与纵向布局对比):展示给用户
  • 最终润色后:展示给用户
5. 保持整组图表的一致性

优化一张图时,检查相同的改进是否也适用于其他图:

# Applied violin->boxplot fix to Figures 2, 7, 10, 11
# Applied size reductions consistently across all figures
# Used same color scheme throughout

总结

系统化优化工作流:

  1. 找出问题 -> 2. 改进可视化效果 -> 3. 提高清晰度 -> 4. 测试布局 -> 5. 优化位置

关键原则:

  • 根据用户反馈进行迭代
  • 测试备选方案(展示选项)
  • 记录更改
  • 将经验应用于整组图表
  • 符合出版标准

常见调整:

  • 点的尺寸:60 -> 25
  • 线宽:2.5 -> 1.5
  • 字体大小:10 -> 8
  • 注释位置:最大值的 105% -> 92%
  • 始终明确设置坐标轴范围

更多指导,请参阅以下支持文件:

评论

支持 Markdown