Skip to content

修复运行时断链 + 字号/间距联动重写 - #1

Open
chendengji wants to merge 2 commits into
mainfrom
fix/runtime-breakages-typography
Open

修复运行时断链 + 字号/间距联动重写#1
chendengji wants to merge 2 commits into
mainfrom
fix/runtime-breakages-typography

Conversation

@chendengji

Copy link
Copy Markdown
Owner

改动概要

运行时断链修复(全 37 图表 × 4 样式 × 三种调用方式实测通过)

问题 修复
boxplot/eventplot labels= mpl 3.9+ 移除 → tick_labels / 手动设刻度
hexbin/hist2d 从 paired 重分到 xy_series
triplot 不再把 z 当 triangles 传入
scatter3d/gridded/irregular 边界 预处理改 dropna(subset=) 避免重名列 DataFrame
ieeetran 样式崩 移除(scienceplots 无此样式)
from src.sci_plot_api import 双模式导入 + src/__init__.py
CLI sci_plot.py 修导入顺序 + --columns x= 映射到 x_col

字号/间距(核心)

  • plot_chart 不再覆盖样式自带 figsize(旧代码强制 (5,4) + 7pt → 大图小字)
  • 新增 _apply_typography:传 figsize= 时字号按比例联动;fontsize= 作主控钮
  • 新增 kwargs:figsize / fontsize / constrained_layout(2D 默认 True) / legend_loc / legend_frame(默认 False)
  • 验证:默认 nature 出图 990×750px = 3.3×2.5in@300dpi + 7pt

文档

  • env 名 geo(非 geo3.13)、图表名 line/scatter(非 xy_line)
  • README 删除不存在的 cell/plos/elsevier/springer/aps/jgr 等样式、修正 plot_chart 签名与图表计数(37)

🤖 Generated with Claude Code

chendengji and others added 2 commits September 1, 2026 20:53
运行时断链(实测修复):
- boxplot/eventplot: labels= 被 mpl 3.9+ 移除 → tick_labels / 手动设刻度
- hexbin/hist2d: 从 paired 重分到 xy_series(原预处理把 x 转 str 致崩)
- triplot: 不再把 z 当 triangles 传入 ax.triplot
- scatter3d/gridded/irregular: 预处理改 dropna(subset=) 避免 x/z 同列名返回重名列 DataFrame
- ieeetran: 从 AVAILABLE_STYLES 移除(scienceplots 无此样式, 调用抛 OSError)
- 导入: 改双模式 + 新增 src/__init__.py, 修 CLI sci_plot.py 导入顺序与 --columns 列名映射

字号/间距(核心):
- plot_chart 不再覆盖样式自带 figsize(nature 原为 3.3x2.5+7pt 被强制改成 5x4 致大图小字)
- 新增 _apply_typography: figsize 自定义时字号按比例联动, fontsize 作主控钮
- 新增 kwargs: figsize/fontsize/constrained_layout(2D 默认 True)/legend_loc/legend_frame(默认 False)
- 3D 因 constrained 支持有限自动回退 tight_layout

文档修正:
- SKILL.md/README/environment.yml: env 名 geo(非 geo3.13), 图表名 line/scatter(非 xy_line)
- README 删除不存在的 cell/plos/elsevier/springer/aps/jgr 等样式, 修正 plot_chart 签名与图表计数(37)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
代码层:
- _apply_typography 扩展为统一缩放: 字号/数据线宽/轴宽/刻度按同比例同步放大
  (figsize 或 fontsize 给定时), 避免大图小字细线失衡
- 新增 DEFAULT_CMAP='viridis' (感知均匀+色盲友好), 场数据图全部改读 cmap kwarg
  (contourf/imshow/pcolormesh/hexbin/hist2d/scatter3d/surface3d/trisurf3d/tricontourf/tripcolor)
- 新增 despine: 2D 折线/柱/散点/统计类默认去顶右轴线(SCI 干净风格),
  场数据图/3D 默认保留四框; despine= kwarg 可覆盖
- 新增 linewidth/cmap/despine kwargs; line.py 线宽改跟随样式+kwarg
- contour/tricontour 等高线标号去掉写死 fontsize=8, 改跟随 font.size 缩放

文档层:
- SKILL.md 「字号与间距约定」扩为「样式与美化规定」9 小节:
  样式选择/统一缩放/配色/线宽刻度/图例/布局轴线/SCI 美化原则/kwargs 总表/LLM 自主性
- README 样式表补统一缩放/cmap/despine 说明, 指向 SKILL.md

回归: 全 37 图表 × 4 样式 + cmap/despine/统一缩放专项通过

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant