Figure Legend Generator
Generate publication-quality figure legends for scientific research charts and images.
Supported Chart Types
| Chart Type | Description |
|---|
| Bar Chart | Compare values across categories |
| Line Graph |
Show trends over time or continuous data |
| Scatter Plot | Display relationships between variables |
| Box Plot | Show distribution and outliers |
| Heatmap | Display matrix data intensity |
| Microscopy | Fluorescence/confocal images |
| Flow Cytometry | FACS plots and histograms |
| Western Blot | Protein expression bands |
Usage
CODEBLOCK0
Parameters
| Parameter | Required | Description |
|---|
| INLINECODE0 | Yes | Path to chart image |
| INLINECODE1 |
Yes | Chart type (bar/line/scatter/box/heatmap/microscopy/flow/western) |
|
--output | No | Output path for legend text (default: stdout) |
|
--format | No | Output format (text/markdown/latex), default: markdown |
|
--language | No | Language (en/zh), default: en |
Examples
CODEBLOCK1
Legend Structure
Generated legends follow academic standards:
- 1. Figure Number - Sequential numbering
- Brief Title - Concise description
- Main Description - What the figure shows
- Data Details - Key statistics/measurements
- Methodology - Brief experimental context
- Statistics - P-values, significance markers
- Scale Bars - For microscopy images
Technical Notes
- - Difficulty: Low
- Dependencies: PIL, pytesseract (optional OCR)
- Processing: Vision analysis for chart type detection
- Output: Structured markdown by default
References
- -
references/legend_templates.md - Templates by chart type - INLINECODE6 - Formatting guidelines
Risk Assessment
| Risk Indicator | Assessment | Level |
|---|
| Code Execution | Python scripts with tools | High |
| Network Access |
External API calls | High |
| File System Access | Read/write data | Medium |
| Instruction Tampering | Standard prompt guidelines | Low |
| Data Exposure | Data handled securely | Medium |
Security Checklist
- - [ ] No hardcoded credentials or API keys
- [ ] No unauthorized file system access (../)
- [ ] Output does not expose sensitive information
- [ ] Prompt injection protections in place
- [ ] API requests use HTTPS only
- [ ] Input validated against allowed patterns
- [ ] API timeout and retry mechanisms implemented
- [ ] Output directory restricted to workspace
- [ ] Script execution in sandboxed environment
- [ ] Error messages sanitized (no internal paths exposed)
- [ ] Dependencies audited
- [ ] No exposure of internal service architecture
Prerequisites
CODEBLOCK2
Evaluation Criteria
Success Metrics
- - [ ] Successfully executes main functionality
- [ ] Output meets quality standards
- [ ] Handles edge cases gracefully
- [ ] Performance is acceptable
Test Cases
- 1. Basic Functionality: Standard input → Expected output
- Edge Case: Invalid input → Graceful error handling
- Performance: Large dataset → Acceptable processing time
Lifecycle Status
- - Current Stage: Draft
- Next Review Date: 2026-03-06
- Known Issues: None
- Planned Improvements:
- Performance optimization
- Additional feature support
图表图例生成器
为科研图表和图像生成符合出版标准的图例。
支持的图表类型
展示随时间或连续数据的变化趋势 |
| 散点图 | 显示变量之间的关系 |
| 箱线图 | 展示数据分布和异常值 |
| 热力图 | 显示矩阵数据强度 |
| 显微镜图像 | 荧光/共聚焦图像 |
| 流式细胞术 | FACS图和直方图 |
| 蛋白质印迹 | 蛋白表达条带 |
使用方法
bash
python scripts/main.py --input <图像路径> --type <图表类型> [--output <输出路径>]
参数说明
| 参数 | 必填 | 描述 |
|---|
| --input | 是 | 图表图像路径 |
| --type |
是 | 图表类型(bar/line/scatter/box/heatmap/microscopy/flow/western) |
| --output | 否 | 图例文本输出路径(默认:标准输出) |
| --format | 否 | 输出格式(text/markdown/latex),默认:markdown |
| --language | 否 | 语言(en/zh),默认:en |
示例
bash
为柱状图生成图例
python scripts/main.py --input figure1.png --type bar
保存到文件
python scripts/main.py --input plot.jpg --type line --output legend.md
中文输出
python scripts/main.py --image.png --type scatter --language zh
图例结构
生成的图例遵循学术标准:
- 1. 图号 - 顺序编号
- 简短标题 - 简洁描述
- 主要描述 - 图表展示内容
- 数据详情 - 关键统计/测量数据
- 方法学 - 简要实验背景
- 统计学 - P值、显著性标记
- 比例尺 - 显微镜图像专用
技术说明
- - 难度:低
- 依赖项:PIL、pytesseract(可选OCR)
- 处理方式:视觉分析用于图表类型检测
- 输出格式:默认结构化markdown
参考资料
- - references/legendtemplates.md - 按图表类型分类的模板
- references/academicstyle_guide.md - 格式指南
风险评估
| 风险指标 | 评估 | 等级 |
|---|
| 代码执行 | 带工具的Python脚本 | 高 |
| 网络访问 |
外部API调用 | 高 |
| 文件系统访问 | 读写数据 | 中 |
| 指令篡改 | 标准提示词指南 | 低 |
| 数据泄露 | 安全处理数据 | 中 |
安全检查清单
- - [ ] 无硬编码凭据或API密钥
- [ ] 无未经授权的文件系统访问(../)
- [ ] 输出不暴露敏感信息
- [ ] 已实施提示注入防护
- [ ] API请求仅使用HTTPS
- [ ] 输入已根据允许模式进行验证
- [ ] 已实现API超时和重试机制
- [ ] 输出目录限制在工作空间内
- [ ] 脚本在沙盒环境中执行
- [ ] 错误消息已清理(不暴露内部路径)
- [ ] 依赖项已审计
- [ ] 不暴露内部服务架构
前置条件
bash
Python依赖项
pip install -r requirements.txt
评估标准
成功指标
- - [ ] 成功执行主要功能
- [ ] 输出符合质量标准
- [ ] 优雅处理边缘情况
- [ ] 性能可接受
测试用例
- 1. 基本功能:标准输入 → 预期输出
- 边缘情况:无效输入 → 优雅错误处理
- 性能测试:大数据集 → 可接受处理时间
生命周期状态
- - 当前阶段:草稿
- 下次审核日期:2026-03-06
- 已知问题:无
- 计划改进:
- 性能优化
- 额外功能支持