scientific-figure-pro
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseScientific Figure Pro
科学图表生成工具(Scientific Figure Pro)
Use this skill to create or revise publication figures with consistent aesthetics from the figures4papers project.
使用此技能,可借助figures4papers项目的统一视觉风格,创建或修改可用于出版的图表。
Workflow
工作流程
- Identify the figure family (bar, trend, heatmap, scatter, multi-panel, conceptual illustration).
- Load helper APIs from .
scripts/scientific_figure_pro.py - Apply style first with .
apply_publication_style(...) - Build the figure using helpers.
make_* - Export with to keep layout and output defaults consistent.
finalize_figure(...)
- 确定图表类型(条形图、趋势图、热图、散点图、多面板图、概念示意图)。
- 从加载辅助API。
scripts/scientific_figure_pro.py - 首先使用应用出版风格。
apply_publication_style(...) - 使用系列辅助函数构建图表。
make_* - 通过导出,确保布局和输出默认设置一致。
finalize_figure(...)
Use The Helper Module
使用辅助模块
Load by file path when package imports are inconvenient:
python
import importlib.util
from pathlib import Path
import matplotlib.pyplot as plt
module_path = Path("skills/scientific-figure-pro/scripts/scientific_figure_pro.py")
spec = importlib.util.spec_from_file_location("scientific_figure_pro", module_path)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)当无法通过包导入时,可通过文件路径加载:
python
import importlib.util
from pathlib import Path
import matplotlib.pyplot as plt
module_path = Path("skills/scientific-figure-pro/scripts/scientific_figure_pro.py")
spec = importlib.util.spec_from_file_location("scientific_figure_pro", module_path)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)Core APIs
核心API
- : Configure typography and axis linewidth.
FigureStyle(...) - : Apply global rcParams.
apply_publication_style(style=None) - : Create flattened axes.
create_subplots(nrows, ncols, figsize, **kwargs) - : Build grouped bars with publication defaults.
make_grouped_bar(...) - : Build trend lines with optional confidence shadow.
make_trend(...) - : Build heatmaps with optional labels and annotations.
make_heatmap(...) - : Build clean scatter plots.
make_scatter(...) - : Build conceptual shaded sphere panels.
make_sphere_illustration(...) - : Save outputs consistently.
finalize_figure(fig, out_path, formats=None, dpi=300, pad=0.05)
- :配置字体样式和坐标轴线条宽度。
FigureStyle(...) - :应用全局rcParams设置。
apply_publication_style(style=None) - :创建扁平化的坐标轴对象。
create_subplots(nrows, ncols, figsize, **kwargs) - :使用出版默认设置构建分组条形图。
make_grouped_bar(...) - :构建带可选置信区间阴影的趋势线。
make_trend(...) - :构建带可选标签和注释的热图。
make_heatmap(...) - :构建简洁的散点图。
make_scatter(...) - :构建带阴影的球形概念示意图。
make_sphere_illustration(...) - :统一保存输出文件。
finalize_figure(fig, out_path, formats=None, dpi=300, pad=0.05)
Style Policy
风格规范
- Use Helvetica/Arial-like sans-serif families.
- Remove top/right spines.
- Keep legends frameless.
- Use semantic palette mapping:
- blue for target/proposed method,
- green for improvements,
- red for contrasts/baselines,
- neutral for support categories.
- Use by default and
dpi=300for dense bar panels.dpi=600
- 使用类似Helvetica/Arial的无衬线字体。
- 移除顶部和右侧的坐标轴边框。
- 图例不使用边框。
- 使用语义化配色方案:
- 蓝色:目标/提出的方法,
- 绿色:改进项,
- 红色:对比/基线,
- 中性色:支持类内容。
- 默认使用,密集条形图面板使用
dpi=300。dpi=600
Practical Defaults
实用默认设置
- Dense benchmark bars: and wide canvas.
FigureStyle(font_size=24, axes_linewidth=3) - Compact analysis charts: .
FigureStyle(font_size=15 or 16, axes_linewidth=2) - Finalize every figure through instead of direct
finalize_figure(...).plt.savefig(...)
- 密集基准条形图:使用并搭配宽画布。
FigureStyle(font_size=24, axes_linewidth=3) - 紧凑分析图表:使用。
FigureStyle(font_size=15或16, axes_linewidth=2) - 所有图表均通过完成导出,而非直接使用
finalize_figure(...)。plt.savefig(...)
Dependencies
依赖项
- Python 3.8+
matplotlibnumpy
- Python 3.8及以上版本
matplotlibnumpy
References
参考资料
- Read when you need style rationale and reproduction rules.
references/design_theory.md
- 如需了解风格设计依据和复现规则,请阅读。
references/design_theory.md