Skip to content

Physical-unit stacking (cm), editable peak markers, custom colors & precise figure sizing - #2

Open
Hongcheng-LI wants to merge 1 commit into
himsang5ms:mainfrom
Hongcheng-LI:feat/physical-cm-stacking-and-customization
Open

Hongcheng-LI wants to merge 1 commit into
himsang5ms:mainfrom
Hongcheng-LI:feat/physical-cm-stacking-and-customization

Conversation

@Hongcheng-LI

Copy link
Copy Markdown

中文说明

你好!我们此前已联系并获得你的授权,将 HPLC-Data-Visualizer 移植到了我们的学术导航站 SynBioPath 中。在移植和实际使用的过程中,我们把以下改进做了出来,现在把这套改进按上游的代码风格移植回来,希望能回馈给原项目和大家:

主要改进

  1. 厘米归一化堆叠(物理单位)
    • 每条曲线的幅值归一化到固定高度(默认 1 cm),相邻曲线间距同样以厘米设置
    • 画布高度按 96dpi 从厘米反推(1 cm = 37.8 px),屏显与导出 SVG/PNG 中的 1 cm 就是物理 1 厘米
    • 曲线数量增多时画布自动长高,曲线高度永远不会被压缩;最下方曲线基线固定悬浮在 X 轴上方 0.5 cm
  2. 峰标记升级
    • 点击曲线添加标记时自动编号(1、2、3…),编号文字可直接编辑,字号可调
    • 虚线辅助线只延伸到峰顶截止(不再通到画布顶部),并去掉了文字外框
  3. 染色与颜色自定义
    • 框选染色只填充"曲线到基线"之间的区域(包括 All 目标),不再遮挡曲线间的空白
    • 每条曲线、每个染色区域都支持自定义颜色(颜色选择器)
  4. 精确物理尺寸
    • 绘图区宽度(不含样品名边距)以厘米直接输入;坐标轴线粗细、刻度字号可调
    • X 轴范围改为数字输入框,输入过程不再被重置
  5. 兼容性
    • 旧会话的 set 形式标记自动迁移为带编号的字典;generate_plot 旧参数保持向后兼容

English Summary

Ported back a set of improvements we built for the SynBioPath web port (with permission): cm-normalized waterfall stacking with figure height derived at 96dpi (on-screen cm == exported cm, curve heights never compress), editable labeled peak markers whose guide lines stop at the peak top, region fills that hug each curve down to its own baseline with custom colors, per-curve colors, physical plot-area width in cm, and adjustable axis line width / tick font size. Fully backward compatible with the existing generate_plot API and legacy session state.

测试 / Testing

  • 无头引擎测试:高度/宽度厘米换算、Y 轴范围、标记注释(无框、黑色、字号)、自定义颜色、区域填充数量全部断言通过
  • Streamlit AppTest 全场景:载入示例 → 调整高度/偏移/范围/宽度/线宽/字号 → 注入标记与染色 → 修改编号,全程无异常
  • Headless engine assertions (cm conversion, y-range, marker annotations without borders, custom colors, region fill count) and a full Streamlit AppTest run all pass.

期待你的反馈,也欢迎指出哪些地方需要按上游的规划调整!

…d precise figure sizing

- cm-normalized stacking: each curve normalized to a fixed height (default 1 cm)
  with an adjustable offset in cm; figure height derived from 96dpi so on-screen
  and exported 1 cm match exactly; curve heights never compress as traces are added
- bottom baseline fixed 0.5 cm above the X axis
- peak markers: editable numeric labels, adjustable font size, dashed guide line
  stops at the peak top, no border box
- region fills hug each curve down to its baseline (including the All target)
  with per-region custom colors; per-curve custom colors via color pickers
- X range typed numerically instead of a slider; plot area width set in
  centimeters (excluding label margins); adjustable axis line width and tick
  font size
- migrate legacy set-based marked_peaks to labeled dicts (backward compatible)
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