
Drawio Diagram
- 202 installs
- 2.5k repo stars
- Updated July 19, 2026
- xstongxue/best-skills
Use drawio-diagram for development tasks
About
drawio-diagram: A skill skill for development. This skill provides functionality for development workflows.
- drawio-diagram
Drawio Diagram by the numbers
- 202 all-time installs (skills.sh)
- +5 installs in the week ending Jul 27, 2026 (Skillselion tracking)
- Ranked #1,997 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/xstongxue/best-skills --skill drawio-diagramAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 202 |
|---|---|
| repo stars | ★ 2.5k |
| Last updated | July 19, 2026 |
| Repository | xstongxue/best-skills ↗ |
What it does
Use drawio-diagram for development tasks
Files
Draw.io 图表
本 Skill 指导 Agent 生成标准的 Draw.io 格式图表(.drawio 文件),支持两种模式:从零生成(模型架构、算法流程等)与风格迁移(参考图 + 内容 → 按参考图风格生成新图)。
Step 0:任务识别
| 条件 | 执行 |
|---|---|
| 用户提供参考图,且希望「按这张图的风格」画新图 | 执行 reference/style-migration.md |
| 其他情况(从零生成) | 执行 reference/generation.md |
使用时机
从零生成:
- 用户需要为深度学习模型(如 Transformer、CNN、RNN 等)生成架构图
- 用户需要绘制算法流程图、数据流图、系统架构图
- 用户需要可视化特定概念(如感受野、注意力机制、特征提取过程等)
- 用户提到「画个图」「生成架构图」「可视化模型结构」「绘制流程图」等需求
风格迁移:
- 用户提供参考图,希望「按这个风格画」「照着这个排版/配色画」
通用规范(两种模式共用)
1. XML 格式严格性
- ✅ 所有标签必须正确闭合:
<mxCell>对应</mxCell>,绝不能写成</mCell> - ✅ 使用
vertex="1"标记节点,edge="1"标记连线 - ✅ 每个元素必须有唯一
id,从 0 开始递增 - ✅ 特殊字符必须转义:
&→&,<→<,>→>
2. 标准文件结构
<mxfile host="app.diagrams.net">
<diagram name="图表名称" id="图表id">
<mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="宽度" pageHeight="高度" background="#F5F5DC">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<!-- 所有图形元素从 id="2" 开始 -->
</root>
</mxGraphModel>
</diagram>
</mxfile>3. 常用样式
- 2D 节点:
rounded=1;whiteSpace=wrap;html=1;fillColor=#颜色;strokeColor=#333333;strokeWidth=1;fontSize=11 - 3D 节点(推荐用于神经网络层):
shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;size=20;fillColor=#颜色;strokeColor=#333333;strokeWidth=1.5 - 连线:
edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;strokeColor=#000000;strokeWidth=2;endArrow=classic - 虚线(残差):
dashed=1
4. 输出要求
1. 图表说明(2-3 行) 2. 使用指南:Draw.io 打开、导出 PNG/SVG/PDF、图题与论文引用示例
参考资源
- Draw.io:https://app.diagrams.net/
- 官方文档:https://www.drawio.com/doc/
生物示意图
考试题目中的生物示意图:细胞结构图、遗传图解、食物链/食物网、生态系统、有丝分裂等。
通用规范
- 背景白色
background="#FFFFFF",生物配色偏绿/暖色系 - 细胞结构用嵌套椭圆/矩形表示,标注文字 11–13px
- 遗传图解用表格式布局,等位基因用上标表示(Draw.io 文字中用
¹等)
配色方案
| 结构 | 填充色 | 说明 |
|---|---|---|
| 细胞膜 | none(透明) | 只显示边框 |
| 细胞质 | #F0FFF0(淡绿) | 背景色 |
| 细胞核 | #FFF2CC | 圆形/椭圆 |
| 线粒体 | #FFE6CC | 椭圆 |
| 叶绿体 | #D5E8D4 | 椭圆 |
| 液泡 | #DAE8FC | 大椭圆 |
动物细胞结构图
<!-- 细胞膜(最外层椭圆) -->
<mxCell id="2" value="" style="ellipse;whiteSpace=wrap;html=1;fillColor=#F0FFF0;strokeColor=#82B366;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="60" y="60" width="400" height="300" as="geometry"/>
</mxCell>
<!-- 细胞核 -->
<mxCell id="3" value="细胞核" style="ellipse;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;strokeWidth=1.5;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="170" y="130" width="120" height="90" as="geometry"/>
</mxCell>
<!-- 线粒体 -->
<mxCell id="4" value="线粒体" style="ellipse;whiteSpace=wrap;html=1;fillColor=#FFE6CC;strokeColor=#D79B00;strokeWidth=1.5;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="300" y="160" width="90" height="60" as="geometry"/>
</mxCell>
<!-- 内质网(折线示意) -->
<mxCell id="5" value="内质网" style="text;html=1;fontSize=11;align=center;" vertex="1" parent="1">
<mxGeometry x="80" y="200" width="70" height="20" as="geometry"/>
</mxCell>
<!-- 细胞膜标注 -->
<mxCell id="6" value="细胞膜" style="text;html=1;fontSize=12;align=left;" vertex="1" parent="1">
<mxGeometry x="10" y="90" width="60" height="20" as="geometry"/>
</mxCell>
<!-- 引线:细胞膜标注 → 边界 -->
<mxCell id="7" value="" style="endArrow=none;html=1;strokeWidth=1;dashed=1;strokeColor=#666666;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="70" y="100" as="sourcePoint"/><mxPoint x="120" y="100" as="targetPoint"/></mxGeometry>
</mxCell>植物细胞结构图
<!-- 细胞壁(最外层矩形) -->
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#555555;strokeWidth=3;" vertex="1" parent="1">
<mxGeometry x="60" y="60" width="400" height="320" as="geometry"/>
</mxCell>
<!-- 细胞膜(紧贴细胞壁内侧) -->
<mxCell id="3" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#F0FFF0;strokeColor=#82B366;strokeWidth=1.5;" vertex="1" parent="1">
<mxGeometry x="70" y="70" width="380" height="300" as="geometry"/>
</mxCell>
<!-- 大液泡(占中间大部分) -->
<mxCell id="4" value="液泡" style="ellipse;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;strokeWidth=1.5;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="150" y="130" width="200" height="160" as="geometry"/>
</mxCell>
<!-- 叶绿体 -->
<mxCell id="5" value="叶绿体" style="ellipse;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;strokeWidth=1.5;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="80" y="160" width="80" height="50" as="geometry"/>
</mxCell>
<!-- 细胞核(在液泡旁) -->
<mxCell id="6" value="细胞核" style="ellipse;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;strokeWidth=1.5;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="360" y="170" width="70" height="60" as="geometry"/>
</mxCell>
<!-- 标注:细胞壁 -->
<mxCell id="7" value="细胞壁" style="text;html=1;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="464" y="60" width="60" height="20" as="geometry"/>
</mxCell>遗传图解(孟德尔豌豆杂交)
用表格式布局,亲本 → 配子 → 子代。
<!-- 亲本标题行 -->
<mxCell id="2" value="亲本 (P)" style="text;html=1;fontSize=13;fontStyle=1;align=right;" vertex="1" parent="1">
<mxGeometry x="20" y="40" width="80" height="30" as="geometry"/>
</mxCell>
<!-- 亲本基因型 AA -->
<mxCell id="3" value="AA(高茎)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="120" y="40" width="120" height="36" as="geometry"/>
</mxCell>
<!-- × 符号 -->
<mxCell id="4" value="×" style="text;html=1;fontSize=18;fontStyle=1;align=center;" vertex="1" parent="1">
<mxGeometry x="252" y="40" width="36" height="36" as="geometry"/>
</mxCell>
<!-- 亲本基因型 aa -->
<mxCell id="5" value="aa(矮茎)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#F8CECC;strokeColor=#B85450;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="300" y="40" width="120" height="36" as="geometry"/>
</mxCell>
<!-- 减数分裂箭头 -->
<mxCell id="6" value="减数分裂" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;fontSize=11;verticalAlign=bottom;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="180" y="76" as="sourcePoint"/><mxPoint x="180" y="130" as="targetPoint"/></mxGeometry>
</mxCell>
<mxCell id="7" value="减数分裂" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;fontSize=11;verticalAlign=bottom;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="360" y="76" as="sourcePoint"/><mxPoint x="360" y="130" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 配子 -->
<mxCell id="8" value="配子" style="text;html=1;fontSize=13;fontStyle=1;align=right;" vertex="1" parent="1">
<mxGeometry x="20" y="130" width="80" height="30" as="geometry"/>
</mxCell>
<mxCell id="9" value="A" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="152" y="130" width="56" height="56" as="geometry"/>
</mxCell>
<mxCell id="10" value="a" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#F8CECC;strokeColor=#B85450;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="332" y="130" width="56" height="56" as="geometry"/>
</mxCell>
<!-- 受精箭头 -->
<mxCell id="11" value="受精" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;fontSize=11;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="270" y="158" as="sourcePoint"/><mxPoint x="270" y="220" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 子代 F1 -->
<mxCell id="12" value="子代 (F₁)" style="text;html=1;fontSize=13;fontStyle=1;align=right;" vertex="1" parent="1">
<mxGeometry x="20" y="220" width="80" height="30" as="geometry"/>
</mxCell>
<mxCell id="13" value="Aa(高茎)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="180" y="220" width="180" height="36" as="geometry"/>
</mxCell>食物链/食物网
<!-- 生产者 -->
<mxCell id="2" value="草(生产者)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="60" y="200" width="120" height="40" as="geometry"/>
</mxCell>
<!-- 初级消费者 -->
<mxCell id="3" value="兔(初级消费者)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="260" y="140" width="140" height="40" as="geometry"/>
</mxCell>
<!-- 次级消费者 -->
<mxCell id="4" value="狐(次级消费者)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFE6CC;strokeColor=#D79B00;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="480" y="200" width="140" height="40" as="geometry"/>
</mxCell>
<!-- 箭头:能量流动方向 -->
<mxCell id="5" value="" style="endArrow=block;endFill=1;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="3">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="6" value="" style="endArrow=block;endFill=1;html=1;strokeWidth=1.5;" edge="1" parent="1" source="3" target="4">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- 说明文字 -->
<mxCell id="7" value="(箭头方向代表能量流动)" style="text;html=1;fontSize=11;fontStyle=2;align=center;" vertex="1" parent="1">
<mxGeometry x="160" y="300" width="360" height="20" as="geometry"/>
</mxCell>化学示意图
考试题目中的化学示意图:实验装置图、原子/分子结构、化学反应方程式注解、元素周期表局部等。
通用规范
- 背景白色
background="#FFFFFF",线条黑色#000000,线宽 1.5 - 仪器轮廓用简化几何形状,标注文字用小字(12px)
- 化学键(单键/双键)用直线/双线表示,键长均匀
实验装置图
元件用简化形状拼接,导管用折线连接。
常用仪器形状
<!-- 烧瓶(圆形瓶身 + 细颈) -->
<mxCell id="2" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=none;strokeColor=#000000;strokeWidth=1.5;" vertex="1" parent="1">
<mxGeometry x="160" y="180" width="160" height="160" as="geometry"/>
</mxCell>
<!-- 细颈(矩形细长) -->
<mxCell id="3" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=1.5;" vertex="1" parent="1">
<mxGeometry x="218" y="100" width="44" height="80" as="geometry"/>
</mxCell>
<!-- 试管(圆角矩形,底部圆弧) -->
<mxCell id="4" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=1.5;arcSize=40;" vertex="1" parent="1">
<mxGeometry x="340" y="120" width="50" height="120" as="geometry"/>
</mxCell>
<!-- 酒精灯(梯形灯座 + 灯芯) -->
<mxCell id="5" value="酒精灯" style="shape=mxgraph.basic.trapezoid;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=1.5;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="80" y="340" width="100" height="60" as="geometry"/>
</mxCell>
<!-- 导管(折线,用 orthogonalEdgeStyle) -->
<mxCell id="6" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;strokeWidth=1.5;endArrow=none;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="240" y="100" as="sourcePoint"/><mxPoint x="340" y="140" as="targetPoint"/></mxGeometry>
</mxCell>完整装置示例(制取气体)
<!-- 圆底烧瓶 -->
<mxCell id="2" value="" style="ellipse;aspect=fixed;fillColor=none;strokeColor=#000000;strokeWidth=1.5;html=1;" vertex="1" parent="1">
<mxGeometry x="80" y="200" width="140" height="140" as="geometry"/>
</mxCell>
<!-- 烧瓶颈 -->
<mxCell id="3" value="" style="rounded=0;fillColor=none;strokeColor=#000000;strokeWidth=1.5;html=1;" vertex="1" parent="1">
<mxGeometry x="132" y="120" width="36" height="80" as="geometry"/>
</mxCell>
<!-- 瓶塞 -->
<mxCell id="4" value="" style="shape=mxgraph.basic.trapezoid;flipV=1;fillColor=#CCCCCC;strokeColor=#000000;strokeWidth=1.5;html=1;" vertex="1" parent="1">
<mxGeometry x="126" y="100" width="48" height="24" as="geometry"/>
</mxCell>
<!-- 收集装置(试管) -->
<mxCell id="5" value="" style="rounded=1;arcSize=40;fillColor=none;strokeColor=#000000;strokeWidth=1.5;html=1;" vertex="1" parent="1">
<mxGeometry x="340" y="140" width="50" height="120" as="geometry"/>
</mxCell>
<!-- 导管 -->
<mxCell id="6" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;strokeWidth=1.5;endArrow=none;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="168" y="112" as="sourcePoint"/><mxPoint x="340" y="160" as="targetPoint"/><Array as="points"><mxPoint x="260" y="112"/><mxPoint x="260" y="160"/></Array></mxGeometry>
</mxCell>
<!-- 标注:烧瓶 -->
<mxCell id="7" value="圆底烧瓶" style="text;html=1;fontSize=11;align=center;" vertex="1" parent="1">
<mxGeometry x="80" y="348" width="80" height="20" as="geometry"/>
</mxCell>
<!-- 标注:收集装置 -->
<mxCell id="8" value="收集装置" style="text;html=1;fontSize=11;align=center;" vertex="1" parent="1">
<mxGeometry x="318" y="268" width="80" height="20" as="geometry"/>
</mxCell>原子结构示意图
<!-- 原子核(圆形,标注质子数) -->
<mxCell id="2" value="6p
6n" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#FFE6CC;strokeColor=#D79B00;strokeWidth=1.5;fontSize=12;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="210" y="190" width="60" height="60" as="geometry"/>
</mxCell>
<!-- 第一电子层(虚线圆) -->
<mxCell id="3" value="" style="ellipse;aspect=fixed;fillColor=none;strokeColor=#666666;strokeWidth=1;dashed=1;html=1;" vertex="1" parent="1">
<mxGeometry x="160" y="140" width="160" height="160" as="geometry"/>
</mxCell>
<!-- 第二电子层 -->
<mxCell id="4" value="" style="ellipse;aspect=fixed;fillColor=none;strokeColor=#666666;strokeWidth=1;dashed=1;html=1;" vertex="1" parent="1">
<mxGeometry x="100" y="80" width="280" height="280" as="geometry"/>
</mxCell>
<!-- 电子(小圆点)第一层 2 个 -->
<mxCell id="5" value="2" style="text;html=1;fontSize=12;align=center;" vertex="1" parent="1">
<mxGeometry x="224" y="120" width="20" height="20" as="geometry"/>
</mxCell>
<!-- 电子(小圆点)第二层 4 个 -->
<mxCell id="6" value="4" style="text;html=1;fontSize=12;align=center;" vertex="1" parent="1">
<mxGeometry x="224" y="58" width="20" height="20" as="geometry"/>
</mxCell>
<!-- 元素符号标注 -->
<mxCell id="7" value="碳 (C)" style="text;html=1;fontSize=14;fontStyle=1;align=center;" vertex="1" parent="1">
<mxGeometry x="190" y="380" width="100" height="24" as="geometry"/>
</mxCell>分子结构示意图(Lewis 式)
用矩形(原子)+ 线(化学键)表示。
<!-- 水分子 H₂O -->
<!-- O 原子(中心) -->
<mxCell id="2" value="O" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=16;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="210" y="180" width="60" height="60" as="geometry"/>
</mxCell>
<!-- H 原子(左) -->
<mxCell id="3" value="H" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;fontSize=15;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="100" y="220" width="50" height="50" as="geometry"/>
</mxCell>
<!-- H 原子(右) -->
<mxCell id="4" value="H" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;fontSize=15;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="330" y="220" width="50" height="50" as="geometry"/>
</mxCell>
<!-- 共价键 O-H(单键) -->
<mxCell id="5" value="" style="endArrow=none;html=1;strokeWidth=2;strokeColor=#000000;" edge="1" parent="1" source="2" target="3">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="6" value="" style="endArrow=none;html=1;strokeWidth=2;strokeColor=#000000;" edge="1" parent="1" source="2" target="4">
<mxGeometry relative="1" as="geometry"/>
</mxCell>化学反应方程式注解图
<!-- 反应物 A -->
<mxCell id="2" value="2H₂" style="text;html=1;fontSize=18;fontStyle=1;align=center;" vertex="1" parent="1">
<mxGeometry x="60" y="160" width="80" height="40" as="geometry"/>
</mxCell>
<!-- 加号 -->
<mxCell id="3" value="+" style="text;html=1;fontSize=20;align=center;" vertex="1" parent="1">
<mxGeometry x="148" y="160" width="30" height="40" as="geometry"/>
</mxCell>
<!-- 反应物 B -->
<mxCell id="4" value="O₂" style="text;html=1;fontSize=18;fontStyle=1;align=center;" vertex="1" parent="1">
<mxGeometry x="186" y="160" width="60" height="40" as="geometry"/>
</mxCell>
<!-- 箭头(反应条件写在箭头上方) -->
<mxCell id="5" value="点燃" style="endArrow=block;endFill=1;html=1;strokeWidth=1.5;fontSize=12;verticalAlign=bottom;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="260" y="180" as="sourcePoint"/><mxPoint x="360" y="180" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 生成物 -->
<mxCell id="6" value="2H₂O" style="text;html=1;fontSize=18;fontStyle=1;align=center;" vertex="1" parent="1">
<mxGeometry x="368" y="160" width="100" height="40" as="geometry"/>
</mxCell>
<!-- 注解:H₂ 标注 -->
<mxCell id="7" value="氢气(可燃)" style="text;html=1;fontSize=11;fontStyle=2;align=center;" vertex="1" parent="1">
<mxGeometry x="42" y="210" width="100" height="20" as="geometry"/>
</mxCell>
<!-- 注解:O₂ 标注 -->
<mxCell id="8" value="氧气(助燃)" style="text;html=1;fontSize=11;fontStyle=2;align=center;" vertex="1" parent="1">
<mxGeometry x="166" y="210" width="100" height="20" as="geometry"/>
</mxCell>语文示意图
考试题目中的语文示意图:文章结构图、古诗词脉络图、句子成分分析、思维导图式分析。
通用规范
- 背景白色
background="#FFFFFF" - 节点圆角矩形,线条颜色与节点边框一致
- 连线无箭头(
endArrow=none)或单向箭头,线宽 1.5 - 字号:主题节点 14–16px,分支节点 12–13px
配色方案
| 层级 | 填充色 | 边框色 |
|---|---|---|
| 中心主题 | #FFF2CC | #D6B656 |
| 一级分支 | #DAE8FC | #6C8EBF |
| 二级分支 | #D5E8D4 | #82B366 |
| 三级/补充 | #F8CECC | #B85450 |
文章结构图(线性层次)
适用于记叙文、说明文的段落结构梳理。
<!-- 标题/总结节点 -->
<mxCell id="2" value="全文主旨" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="260" y="40" width="160" height="50" as="geometry"/>
</mxCell>
<!-- 第一部分 -->
<mxCell id="3" value="第一部分(1-3段)
交代背景" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="80" y="160" width="180" height="50" as="geometry"/>
</mxCell>
<!-- 第二部分 -->
<mxCell id="4" value="第二部分(4-8段)
发展高潮" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="300" y="160" width="180" height="50" as="geometry"/>
</mxCell>
<!-- 第三部分 -->
<mxCell id="5" value="第三部分(9段)
结尾升华" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="520" y="160" width="180" height="50" as="geometry"/>
</mxCell>
<!-- 连线:主旨 → 各部分 -->
<mxCell id="6" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="3">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="7" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="4">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="8" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="5">
<mxGeometry relative="1" as="geometry"/>
</mxCell>古诗词脉络图(情感/意象分析)
<!-- 诗题/作者 -->
<mxCell id="2" value="《静夜思》李白" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="240" y="40" width="200" height="50" as="geometry"/>
</mxCell>
<!-- 意象 -->
<mxCell id="3" value="意象
明月·故乡" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="60" y="160" width="160" height="50" as="geometry"/>
</mxCell>
<!-- 情感 -->
<mxCell id="4" value="情感
思乡·孤寂" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="260" y="160" width="160" height="50" as="geometry"/>
</mxCell>
<!-- 手法 -->
<mxCell id="5" value="手法
借景抒情·对比" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#F8CECC;strokeColor=#B85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="460" y="160" width="160" height="50" as="geometry"/>
</mxCell>
<!-- 连线 -->
<mxCell id="6" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="3">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="7" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="4">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="8" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="5">
<mxGeometry relative="1" as="geometry"/>
</mxCell>句子成分分析图
主谓宾定状补,用括号或下划线标注,Draw.io 用分层文字框表示。
<!-- 句子原文 -->
<mxCell id="2" value="他 / 认真地 / 完成了 / 一篇 / 精彩的 / 作文" style="text;html=1;align=center;fontSize=15;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="60" y="60" width="560" height="40" as="geometry"/>
</mxCell>
<!-- 成分标注行 -->
<mxCell id="3" value="主语" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="80" y="120" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="4" value="状语" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="180" y="120" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="5" value="谓语" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="280" y="120" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="6" value="定语" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#F8CECC;strokeColor=#B85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="380" y="120" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="7" value="宾语" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#E1D5E7;strokeColor=#9673A6;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="480" y="120" width="60" height="30" as="geometry"/>
</mxCell>总分总结构图(议论文)
<!-- 引论 -->
<mxCell id="2" value="引论(提出问题)" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="220" y="40" width="240" height="50" as="geometry"/>
</mxCell>
<!-- 论点1 -->
<mxCell id="3" value="分论点一" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="60" y="160" width="140" height="45" as="geometry"/>
</mxCell>
<!-- 论点2 -->
<mxCell id="4" value="分论点二" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="270" y="160" width="140" height="45" as="geometry"/>
</mxCell>
<!-- 论点3 -->
<mxCell id="5" value="分论点三" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="480" y="160" width="140" height="45" as="geometry"/>
</mxCell>
<!-- 结论 -->
<mxCell id="6" value="结论(解决问题)" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="220" y="280" width="240" height="50" as="geometry"/>
</mxCell>
<!-- 连线 -->
<mxCell id="7" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="3"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="8" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="4"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="9" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="5"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="10" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="3" target="6"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="11" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="4" target="6"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="12" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="5" target="6"><mxGeometry relative="1" as="geometry"/></mxCell>地理示意图
考试题目中的地理示意图:经纬网/地球仪、地球圈层结构、地形剖面、气候分布、洋流示意、板块构造等。
通用规范
- 背景白色
background="#FFFFFF",地理配色偏蓝/棕/绿 - 圆形表示地球,箭头表示风向/洋流方向
- 剖面图用梯形/不规则多边形,标注高程
配色参考
| 要素 | 颜色 | 说明 |
|---|---|---|
| 海洋/水体 | #DAE8FC | 蓝色系 |
| 陆地/平原 | #D5E8D4 | 绿色系 |
| 山地/高原 | #FFF2CC | 黄色系 |
| 极地/冰川 | #FFFFFF(白)+ 蓝边 | — |
| 地核 | #F8CECC | 红/橙系 |
| 地幔 | #FFE6CC | 橙系 |
经纬网示意图
<!-- 地球轮廓(圆) -->
<mxCell id="2" value="" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="100" y="80" width="280" height="280" as="geometry"/>
</mxCell>
<!-- 赤道(水平线) -->
<mxCell id="3" value="赤道" style="endArrow=none;html=1;strokeWidth=1.5;strokeColor=#B85450;dashed=0;fontSize=11;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="100" y="220" as="sourcePoint"/><mxPoint x="380" y="220" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 北回归线(虚线) -->
<mxCell id="4" value="北回归线(23.5°N)" style="endArrow=none;html=1;strokeWidth=1;strokeColor=#D79B00;dashed=1;fontSize=10;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="130" y="160" as="sourcePoint"/><mxPoint x="350" y="160" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 南回归线(虚线) -->
<mxCell id="5" value="南回归线(23.5°S)" style="endArrow=none;html=1;strokeWidth=1;strokeColor=#D79B00;dashed=1;fontSize=10;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="130" y="280" as="sourcePoint"/><mxPoint x="350" y="280" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 本初子午线(竖线) -->
<mxCell id="6" value="本初子午线(0°)" style="endArrow=none;html=1;strokeWidth=1.5;strokeColor=#82B366;fontSize=10;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="240" y="80" as="sourcePoint"/><mxPoint x="240" y="360" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 极点标注 -->
<mxCell id="7" value="N" style="text;html=1;fontSize=14;fontStyle=1;align=center;" vertex="1" parent="1">
<mxGeometry x="228" y="54" width="24" height="24" as="geometry"/>
</mxCell>
<mxCell id="8" value="S" style="text;html=1;fontSize=14;fontStyle=1;align=center;" vertex="1" parent="1">
<mxGeometry x="228" y="360" width="24" height="24" as="geometry"/>
</mxCell>地球圈层结构(剖面)
<!-- 地壳(最外层薄环) -->
<mxCell id="2" value="地壳" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;strokeWidth=2;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="60" y="60" width="360" height="360" as="geometry"/>
</mxCell>
<!-- 地幔(中间层) -->
<mxCell id="3" value="地幔" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#FFE6CC;strokeColor=#D79B00;strokeWidth=2;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="110" y="110" width="260" height="260" as="geometry"/>
</mxCell>
<!-- 外核 -->
<mxCell id="4" value="外核" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#F8CECC;strokeColor=#B85450;strokeWidth=2;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="170" y="170" width="140" height="140" as="geometry"/>
</mxCell>
<!-- 内核(最中心) -->
<mxCell id="5" value="内核" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#FF8080;strokeColor=#AE4132;strokeWidth=2;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="210" y="210" width="60" height="60" as="geometry"/>
</mxCell>地形剖面图
<!-- 基线(海平面) -->
<mxCell id="2" value="海平面" style="endArrow=none;html=1;strokeWidth=1.5;fontSize=11;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="60" y="320" as="sourcePoint"/><mxPoint x="540" y="320" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 平原(低矩形) -->
<mxCell id="3" value="平原" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;strokeWidth=1.5;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="80" y="280" width="120" height="40" as="geometry"/>
</mxCell>
<!-- 丘陵(圆角矩形,稍高) -->
<mxCell id="4" value="丘陵" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;strokeWidth=1.5;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="220" y="240" width="100" height="80" as="geometry"/>
</mxCell>
<!-- 山地(高三角形) -->
<mxCell id="5" value="山地" style="shape=mxgraph.basic.isoceles;whiteSpace=wrap;html=1;fillColor=#FFE6CC;strokeColor=#D79B00;strokeWidth=1.5;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="340" y="160" width="140" height="160" as="geometry"/>
</mxCell>
<!-- 高程标注 -->
<mxCell id="6" value="▲ 2000m" style="text;html=1;fontSize=11;align=center;" vertex="1" parent="1">
<mxGeometry x="350" y="134" width="100" height="20" as="geometry"/>
</mxCell>大气环流/风带示意
<!-- 赤道低压带 -->
<mxCell id="2" value="赤道低压带" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="160" y="240" width="280" height="36" as="geometry"/>
</mxCell>
<!-- 信风带(箭头向赤道) -->
<mxCell id="3" value="东北信风" style="endArrow=block;endFill=1;html=1;strokeWidth=1.5;fontSize=12;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="440" y="200" as="sourcePoint"/><mxPoint x="300" y="240" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 副热带高压带 -->
<mxCell id="4" value="副热带高压带(30°N)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="160" y="140" width="280" height="36" as="geometry"/>
</mxCell>
<!-- 西风带(箭头向极地) -->
<mxCell id="5" value="盛行西风" style="endArrow=block;endFill=1;html=1;strokeWidth=1.5;fontSize=12;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="160" y="100" as="sourcePoint"/><mxPoint x="440" y="140" as="targetPoint"/></mxGeometry>
</mxCell>历史示意图
考试题目中的历史示意图:时间轴、朝代更迭图、历史事件关系图、政治制度示意等。
通用规范
- 背景白色
background="#FFFFFF" - 时间轴用横向主线 + 竖向刻度,事件框悬挂在刻度线上
- 朝代/人物节点用矩形,关系用有向箭头
配色方案
| 用途 | 填充色 | 边框色 |
|---|---|---|
| 时间节点 | #FFF2CC | #D6B656 |
| 重大事件 | #F8CECC | #B85450 |
| 朝代/国家 | #DAE8FC | #6C8EBF |
| 人物 | #D5E8D4 | #82B366 |
| 制度/政策 | #E1D5E7 | #9673A6 |
时间轴
<!-- 时间轴主线(横向,带箭头) -->
<mxCell id="2" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=2;strokeColor=#000000;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="60" y="200" as="sourcePoint"/><mxPoint x="560" y="200" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 时间节点 1:刻度线 -->
<mxCell id="3" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="120" y="185" as="sourcePoint"/><mxPoint x="120" y="215" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 时间节点 1:年份标注 -->
<mxCell id="4" value="221 BC" style="text;html=1;fontSize=11;align=center;" vertex="1" parent="1">
<mxGeometry x="90" y="218" width="60" height="18" as="geometry"/>
</mxCell>
<!-- 时间节点 1:事件框(上方) -->
<mxCell id="5" value="秦统一六国" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="74" y="130" width="92" height="40" as="geometry"/>
</mxCell>
<!-- 连线:刻度 → 事件框 -->
<mxCell id="6" value="" style="endArrow=none;html=1;strokeWidth=1;dashed=1;strokeColor=#666666;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="120" y="185" as="sourcePoint"/><mxPoint x="120" y="170" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 时间节点 2 -->
<mxCell id="7" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="280" y="185" as="sourcePoint"/><mxPoint x="280" y="215" as="targetPoint"/></mxGeometry>
</mxCell>
<mxCell id="8" value="206 BC" style="text;html=1;fontSize=11;align=center;" vertex="1" parent="1">
<mxGeometry x="250" y="218" width="60" height="18" as="geometry"/>
</mxCell>
<mxCell id="9" value="汉朝建立" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#F8CECC;strokeColor=#B85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="234" y="240" width="92" height="40" as="geometry"/>
</mxCell>
<mxCell id="10" value="" style="endArrow=none;html=1;strokeWidth=1;dashed=1;strokeColor=#666666;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="280" y="215" as="sourcePoint"/><mxPoint x="280" y="240" as="targetPoint"/></mxGeometry>
</mxCell>朝代更迭图(纵向)
<!-- 朝代 1 -->
<mxCell id="2" value="夏(约2070—1600BC)" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="160" y="60" width="240" height="44" as="geometry"/>
</mxCell>
<!-- 朝代 2 -->
<mxCell id="3" value="商(约1600—1046BC)" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="160" y="140" width="240" height="44" as="geometry"/>
</mxCell>
<!-- 朝代 3 -->
<mxCell id="4" value="西周(1046—771BC)" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="160" y="220" width="240" height="44" as="geometry"/>
</mxCell>
<!-- 更迭箭头 -->
<mxCell id="5" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="3">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="6" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="3" target="4">
<mxGeometry relative="1" as="geometry"/>
</mxCell>政治制度示意图(分封制/郡县制)
<!-- 顶层:天子/皇帝 -->
<mxCell id="2" value="天子" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="240" y="40" width="120" height="50" as="geometry"/>
</mxCell>
<!-- 第二层:诸侯 -->
<mxCell id="3" value="诸侯国 A" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="80" y="160" width="120" height="44" as="geometry"/>
</mxCell>
<mxCell id="4" value="诸侯国 B" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="240" y="160" width="120" height="44" as="geometry"/>
</mxCell>
<mxCell id="5" value="诸侯国 C" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="400" y="160" width="120" height="44" as="geometry"/>
</mxCell>
<!-- 第三层:卿大夫 -->
<mxCell id="6" value="卿大夫" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="80" y="280" width="100" height="40" as="geometry"/>
</mxCell>
<mxCell id="7" value="卿大夫" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="250" y="280" width="100" height="40" as="geometry"/>
</mxCell>
<!-- 连线 -->
<mxCell id="8" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="3"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="9" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="4"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="10" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="5"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="11" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="3" target="6"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="12" value="" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1" source="4" target="7"><mxGeometry relative="1" as="geometry"/></mxCell>历史事件因果关系图
<!-- 原因节点 -->
<mxCell id="2" value="土地兼并严重" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#F8CECC;strokeColor=#B85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="60" y="100" width="140" height="44" as="geometry"/>
</mxCell>
<mxCell id="3" value="赋税沉重" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#F8CECC;strokeColor=#B85450;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="60" y="200" width="140" height="44" as="geometry"/>
</mxCell>
<!-- 结果节点 -->
<mxCell id="4" value="农民起义爆发" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="300" y="150" width="160" height="50" as="geometry"/>
</mxCell>
<!-- 影响节点 -->
<mxCell id="5" value="王朝更迭" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="560" y="150" width="120" height="44" as="geometry"/>
</mxCell>
<!-- 连线 -->
<mxCell id="6" value="" style="endArrow=block;endFill=1;html=1;strokeWidth=1.5;" edge="1" parent="1" source="2" target="4"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="7" value="" style="endArrow=block;endFill=1;html=1;strokeWidth=1.5;" edge="1" parent="1" source="3" target="4"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="8" value="" style="endArrow=block;endFill=1;html=1;strokeWidth=1.5;" edge="1" parent="1" source="4" target="5"><mxGeometry relative="1" as="geometry"/></mxCell>数学几何图形
考试题目中的数学示意图:几何图形、坐标系、数轴、韦恩图等。
通用规范
- 背景白色
background="#FFFFFF",线条黑色#000000,线宽 1.5 - 填充色为
none(空心图形),标注文字(顶点/角/长度)紧贴对应位置 - 辅助线(高、中线、虚线延长线)用
dashed=1,颜色#666666
图形模板
三角形
<!-- 等腰三角形 ABC,底边水平 -->
<mxCell id="2" value="" style="shape=mxgraph.basic.isoceles;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=1.5;" vertex="1" parent="1">
<mxGeometry x="150" y="80" width="200" height="160" as="geometry"/>
</mxCell>
<!-- 顶点标注 A(顶部居中) -->
<mxCell id="3" value="A" style="text;html=1;align=center;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="238" y="56" width="24" height="24" as="geometry"/>
</mxCell>
<!-- 顶点标注 B(左下) -->
<mxCell id="4" value="B" style="text;html=1;align=center;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="122" y="236" width="24" height="24" as="geometry"/>
</mxCell>
<!-- 顶点标注 C(右下) -->
<mxCell id="5" value="C" style="text;html=1;align=center;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="354" y="236" width="24" height="24" as="geometry"/>
</mxCell>直角三角形(用 shape=mxgraph.basic.right_triangle):
<mxCell id="2" value="" style="shape=mxgraph.basic.right_triangle;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=1.5;" vertex="1" parent="1">
<mxGeometry x="100" y="100" width="200" height="160" as="geometry"/>
</mxCell>圆
圆上取点(坐标精度要求)
Draw.io 中 y 轴向下。圆心 (cx, cy),半径 r,角度 θ(从水平右侧起,逆时针为正):
x = cx + r × cos(θ)
y = cy − r × sin(θ)常用方向偏移(乘以实际半径 r):
| 方向 | Δx | Δy(屏幕坐标) |
|---|---|---|
| 右 0° | +r | 0 |
| 右上 45° | +0.707r | −0.707r |
| 上 90° | 0 | −r |
| 左上 135° | −0.707r | −0.707r |
| 左 180° | −r | 0 |
| 左下 225° | −0.707r | +0.707r |
| 下 270° | 0 | +r |
| 右下 315° | +0.707r | +0.707r |
关键规则:弦端点、切点等所有圆上的点,坐标必须满足 (x−cx)² + (y−cy)² = r²,偏差超过 2px 在视觉上会明显偏离圆边。
圆的综合示例(半径 r=150,圆心 (250, 210),画布 560×450)
<!-- 圆(空心,aspect=fixed 保证正圆) -->
<mxCell id="2" value="" style="ellipse;aspect=fixed;fillColor=none;strokeColor=#000000;strokeWidth=2;html=1;" vertex="1" parent="1">
<mxGeometry x="100" y="60" width="300" height="300" as="geometry"/>
</mxCell>
<!-- 圆心小点 -->
<mxCell id="3" value="" style="ellipse;aspect=fixed;fillColor=#000000;strokeColor=#000000;html=1;" vertex="1" parent="1">
<mxGeometry x="247" y="207" width="6" height="6" as="geometry"/>
</mxCell>
<!-- 圆心标注 O -->
<mxCell id="4" value="O" style="text;html=1;align=left;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="256" y="200" width="20" height="20" as="geometry"/>
</mxCell>
<!-- 半径 OA(→ 右侧 0°,A 精确在圆上:cx+r=400, cy=210) -->
<mxCell id="5" value="r" style="endArrow=none;html=1;strokeWidth=1.5;fontSize=13;fontStyle=2;labelPosition=center;verticalLabelPosition=top;align=center;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="250" y="210" as="sourcePoint"/>
<mxPoint x="400" y="210" as="targetPoint"/>
</mxGeometry>
</mxCell>
<!-- 点 A(右,0°:400, 210) -->
<mxCell id="6" value="" style="ellipse;aspect=fixed;fillColor=#000000;strokeColor=#000000;html=1;" vertex="1" parent="1">
<mxGeometry x="397" y="207" width="6" height="6" as="geometry"/>
</mxCell>
<mxCell id="7" value="A" style="text;html=1;align=left;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="406" y="202" width="20" height="20" as="geometry"/>
</mxCell>
<!-- 直径 CD(竖,C 在顶 90°:250,60;D 在底 270°:250,360) -->
<mxCell id="8" value="" style="endArrow=none;html=1;strokeWidth=1.5;strokeColor=#B85450;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="250" y="60" as="sourcePoint"/>
<mxPoint x="250" y="360" as="targetPoint"/>
</mxGeometry>
</mxCell>
<!-- 点 C(顶,90°:250, 60) -->
<mxCell id="9" value="" style="ellipse;aspect=fixed;fillColor=#000000;strokeColor=#000000;html=1;" vertex="1" parent="1">
<mxGeometry x="247" y="57" width="6" height="6" as="geometry"/>
</mxCell>
<mxCell id="10" value="C" style="text;html=1;align=center;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="240" y="36" width="20" height="20" as="geometry"/>
</mxCell>
<!-- 点 D(底,270°:250, 360) -->
<mxCell id="11" value="" style="ellipse;aspect=fixed;fillColor=#000000;strokeColor=#000000;html=1;" vertex="1" parent="1">
<mxGeometry x="247" y="357" width="6" height="6" as="geometry"/>
</mxCell>
<mxCell id="12" value="D" style="text;html=1;align=center;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="240" y="366" width="20" height="20" as="geometry"/>
</mxCell>
<!-- 直径标注 2r -->
<mxCell id="13" value="2r(直径)" style="text;html=1;align=left;fontSize=12;fontColor=#B85450;" vertex="1" parent="1">
<mxGeometry x="258" y="268" width="80" height="20" as="geometry"/>
</mxCell>
<!-- 弦 EF(注意:不能选 θ 和 θ+180° 的组合,否则 EF 就变成直径)
E=140°:x=250+150×cos(140°)=135, y=210-150×sin(140°)=114
F=305°:x=250+150×cos(305°)=336, y=210-150×sin(305°)=333
两角相差 165°,中点 (235,223) ≠ 圆心,确认为非直径弦 -->
<mxCell id="14" value="" style="endArrow=none;html=1;strokeWidth=1.5;strokeColor=#6C8EBF;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="144" y="104" as="sourcePoint"/>
<mxPoint x="356" y="316" as="targetPoint"/>
</mxGeometry>
</mxCell>
<!-- 点 E(135°:144, 104) -->
<mxCell id="15" value="" style="ellipse;aspect=fixed;fillColor=#000000;strokeColor=#000000;html=1;" vertex="1" parent="1">
<mxGeometry x="141" y="101" width="6" height="6" as="geometry"/>
</mxCell>
<mxCell id="16" value="E" style="text;html=1;align=right;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="120" y="94" width="20" height="20" as="geometry"/>
</mxCell>
<!-- 点 F(315°:356, 316) -->
<mxCell id="17" value="" style="ellipse;aspect=fixed;fillColor=#000000;strokeColor=#000000;html=1;" vertex="1" parent="1">
<mxGeometry x="353" y="313" width="6" height="6" as="geometry"/>
</mxCell>
<mxCell id="18" value="F" style="text;html=1;align=left;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="362" y="314" width="20" height="20" as="geometry"/>
</mxCell>
<!-- 弦标注 -->
<mxCell id="19" value="弦 EF" style="text;html=1;align=center;fontSize=12;fontColor=#6C8EBF;" vertex="1" parent="1">
<mxGeometry x="170" y="246" width="50" height="20" as="geometry"/>
</mxCell>
<!-- 切线 PQ(过切点 A,垂直于半径 OA,x 固定在 400) -->
<mxCell id="20" value="" style="endArrow=none;html=1;strokeWidth=1.5;strokeColor=#82B366;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="400" y="110" as="sourcePoint"/>
<mxPoint x="400" y="310" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="21" value="切线" style="text;html=1;align=left;fontSize=12;fontColor=#82B366;" vertex="1" parent="1">
<mxGeometry x="408" y="148" width="40" height="20" as="geometry"/>
</mxCell>
<!-- 直角符号(切点处,边长 10px) -->
<mxCell id="22" value="" style="rounded=0;fillColor=none;strokeColor=#82B366;strokeWidth=1.5;html=1;" vertex="1" parent="1">
<mxGeometry x="390" y="200" width="10" height="10" as="geometry"/>
</mxCell>圆柱
<mxCell id="2" value="" style="shape=mxgraph.basic.cylinder2;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=1.5;" vertex="1" parent="1">
<mxGeometry x="160" y="80" width="160" height="220" as="geometry"/>
</mxCell>圆锥
<mxCell id="2" value="" style="shape=mxgraph.basic.cone;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=1.5;" vertex="1" parent="1">
<mxGeometry x="160" y="80" width="180" height="220" as="geometry"/>
</mxCell>长方体(斜二测画法)
用四边形 + 虚线隐边拼接:
<!-- 前面(矩形) -->
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=1.5;" vertex="1" parent="1">
<mxGeometry x="100" y="160" width="180" height="120" as="geometry"/>
</mxCell>
<!-- 顶面(平行四边形,右上偏移) -->
<mxCell id="3" value="" style="shape=mxgraph.basic.parallelogram;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=1.5;" vertex="1" parent="1">
<mxGeometry x="160" y="80" width="180" height="80" as="geometry"/>
</mxCell>
<!-- 右侧面(平行四边形) -->
<mxCell id="4" value="" style="shape=mxgraph.basic.parallelogram;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#000000;strokeWidth=1.5;direction=south;" vertex="1" parent="1">
<mxGeometry x="280" y="80" width="80" height="200" as="geometry"/>
</mxCell>直角坐标系
<!-- x 轴(带箭头) -->
<mxCell id="2" value="x" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;fontSize=14;fontStyle=1;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="60" y="260" as="sourcePoint"/><mxPoint x="420" y="260" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- y 轴(带箭头) -->
<mxCell id="3" value="y" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;fontSize=14;fontStyle=1;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="220" y="420" as="sourcePoint"/><mxPoint x="220" y="60" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 原点 O -->
<mxCell id="4" value="O" style="text;html=1;align=right;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="196" y="260" width="20" height="20" as="geometry"/>
</mxCell>数轴
<!-- 数轴主线 -->
<mxCell id="2" value="" style="endArrow=open;endFill=0;startArrow=open;startFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="60" y="200" as="sourcePoint"/><mxPoint x="500" y="200" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 刻度点(每个刻度一个短竖线) -->
<mxCell id="3" value="-2" style="text;html=1;align=center;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="134" y="208" width="30" height="20" as="geometry"/>
</mxCell>
<!-- 零点 -->
<mxCell id="4" value="0" style="text;html=1;align=center;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="269" y="208" width="22" height="20" as="geometry"/>
</mxCell>韦恩图(两集合)
<!-- 集合 A -->
<mxCell id="2" value="A" style="ellipse;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;opacity=50;fontSize=14;fontStyle=1;verticalAlign=top;" vertex="1" parent="1">
<mxGeometry x="80" y="100" width="240" height="200" as="geometry"/>
</mxCell>
<!-- 集合 B -->
<mxCell id="3" value="B" style="ellipse;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;opacity=50;fontSize=14;fontStyle=1;verticalAlign=top;" vertex="1" parent="1">
<mxGeometry x="200" y="100" width="240" height="200" as="geometry"/>
</mxCell>函数图像(坐标系)
坐标映射规则
Draw.io y 轴向下,数学坐标转屏幕坐标:
screen_x = origin_x + math_x × scale
screen_y = origin_y − math_y × scale ← 注意负号建议参数:origin = (300, 400),scale = 50px/单位,画布 600×520。
完整示例:y = x² 抛物线
画布 600×520,原点 (300,400),scale=50。
关键坐标(数学 → 屏幕):
- (−2, 4) → (200, 200)
- (−1, 1) → (250, 350)
- (0, 0) → (300, 400) ← 顶点
- (1, 1) → (350, 350)
- (2, 4) → (400, 200)
<!-- x 轴 -->
<mxCell id="2" value="x" style="endArrow=open;endFill=1;html=1;strokeWidth=1.5;fontSize=15;fontStyle=1;labelPosition=right;verticalLabelPosition=middle;align=left;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="50" y="400" as="sourcePoint"/><mxPoint x="550" y="400" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- y 轴 -->
<mxCell id="3" value="y" style="endArrow=open;endFill=1;html=1;strokeWidth=1.5;fontSize=15;fontStyle=1;labelPosition=center;verticalLabelPosition=top;align=center;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="300" y="470" as="sourcePoint"/><mxPoint x="300" y="40" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 原点 O -->
<mxCell id="4" value="O" style="text;html=1;align=right;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="276" y="401" width="20" height="20" as="geometry"/>
</mxCell>
<!-- x 轴标签:-2, -1, 1, 2 -->
<mxCell id="5" value="-2" style="text;html=1;align=center;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="188" y="408" width="24" height="20" as="geometry"/>
</mxCell>
<mxCell id="6" value="-1" style="text;html=1;align=center;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="238" y="408" width="24" height="20" as="geometry"/>
</mxCell>
<mxCell id="7" value="1" style="text;html=1;align=center;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="344" y="408" width="16" height="20" as="geometry"/>
</mxCell>
<mxCell id="8" value="2" style="text;html=1;align=center;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="394" y="408" width="16" height="20" as="geometry"/>
</mxCell>
<!-- y 轴标签:1, 2, 3, 4 -->
<mxCell id="9" value="1" style="text;html=1;align=right;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="272" y="341" width="20" height="18" as="geometry"/>
</mxCell>
<mxCell id="10" value="2" style="text;html=1;align=right;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="272" y="291" width="20" height="18" as="geometry"/>
</mxCell>
<mxCell id="11" value="3" style="text;html=1;align=right;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="272" y="241" width="20" height="18" as="geometry"/>
</mxCell>
<mxCell id="12" value="4" style="text;html=1;align=right;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="272" y="191" width="20" height="18" as="geometry"/>
</mxCell>
<!-- 抛物线 y = x²(curved=1 拟合,取 9 个控制点) -->
<mxCell id="13" value="" style="curved=1;endArrow=none;html=1;strokeWidth=2.5;strokeColor=#D04A22;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="175" y="88" as="sourcePoint"/>
<mxPoint x="425" y="88" as="targetPoint"/>
<Array as="points">
<mxPoint x="200" y="200"/>
<mxPoint x="225" y="288"/>
<mxPoint x="250" y="350"/>
<mxPoint x="275" y="388"/>
<mxPoint x="300" y="400"/>
<mxPoint x="325" y="388"/>
<mxPoint x="350" y="350"/>
<mxPoint x="375" y="288"/>
<mxPoint x="400" y="200"/>
</Array>
</mxGeometry>
</mxCell>
<!-- 函数标签 -->
<mxCell id="14" value="y = x²" style="text;html=1;align=left;fontSize=15;fontStyle=1;fontColor=#D04A22;" vertex="1" parent="1">
<mxGeometry x="416" y="165" width="70" height="24" as="geometry"/>
</mxCell>
<!-- 顶点 (0,0) 标注 -->
<mxCell id="15" value="" style="ellipse;aspect=fixed;fillColor=#D04A22;strokeColor=#D04A22;html=1;" vertex="1" parent="1">
<mxGeometry x="297" y="397" width="6" height="6" as="geometry"/>
</mxCell>
<mxCell id="16" value="顶点 (0,0)" style="text;html=1;align=left;fontSize=11;fontColor=#D04A22;" vertex="1" parent="1">
<mxGeometry x="308" y="396" width="72" height="16" as="geometry"/>
</mxCell>扩展:一次函数 y = kx + b(示例 y = 2x − 1)
取两个端点:x=−1 → screen(250,450);x=3 → screen(450,250)。使用 endArrow=none 直线段连接两点,在线段附近添加函数标签文本。
常见注意事项
- 同一坐标系绘制多个函数时,为每条曲线选用不同颜色(
strokeColor)并在旁边标注函数表达式 - 特殊点(交点、零点、极值点)用小实心圆
ellipse;aspect=fixed;fillColor=#颜色标出,直径 6px - 刻度标签不要和轴线重叠,x 轴标签放 y=408,y 轴标签放 x=272(对齐右侧)
物理示意图
考试题目中的物理示意图:受力分析图、电路图、光路图、运动轨迹图。
通用规范
- 背景白色
background="#FFFFFF",线条黑色#000000 - 力箭头用实心箭头
endArrow=block;endFill=1,线宽 1.5–2 - 辅助线(法线、参考线)用虚线
dashed=1,颜色#666666 - 力标注用粗体(
fontStyle=1),字号 13–14px
受力分析图
物体(正方形或圆形)居中,各方向力箭头从物体边界出发,长度表示大小。
<!-- 物体(水平面上的正方体) -->
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#E0E0E0;strokeColor=#000000;strokeWidth=1.5;" vertex="1" parent="1">
<mxGeometry x="200" y="200" width="80" height="80" as="geometry"/>
</mxCell>
<!-- 重力 G(向下,从底面中点出发) -->
<mxCell id="3" value="G" style="endArrow=block;endFill=1;html=1;strokeWidth=2;fontStyle=1;fontSize=14;labelPosition=right;align=left;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="240" y="280" as="sourcePoint"/><mxPoint x="240" y="380" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 支持力 N(向上,从顶面中点出发) -->
<mxCell id="4" value="N" style="endArrow=block;endFill=1;html=1;strokeWidth=2;fontStyle=1;fontSize=14;labelPosition=right;align=left;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="240" y="200" as="sourcePoint"/><mxPoint x="240" y="100" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 摩擦力 f(向右,从右侧面中点出发) -->
<mxCell id="5" value="f" style="endArrow=block;endFill=1;html=1;strokeWidth=2;fontStyle=1;fontSize=14;labelPosition=top;align=center;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="280" y="240" as="sourcePoint"/><mxPoint x="380" y="240" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 水平面(物体下方) -->
<mxCell id="6" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="100" y="280" as="sourcePoint"/><mxPoint x="380" y="280" as="targetPoint"/></mxGeometry>
</mxCell>斜面受力图
<!-- 斜面(三角形) -->
<mxCell id="2" value="" style="shape=mxgraph.basic.right_triangle;whiteSpace=wrap;html=1;fillColor=#F5F5F5;strokeColor=#000000;strokeWidth=1.5;" vertex="1" parent="1">
<mxGeometry x="80" y="180" width="280" height="160" as="geometry"/>
</mxCell>
<!-- 斜面上的物体(小正方形) -->
<mxCell id="3" value="" style="rounded=0;fillColor=#E0E0E0;strokeColor=#000000;strokeWidth=1.5;" vertex="1" parent="1">
<mxGeometry x="180" y="220" width="50" height="50" as="geometry"/>
</mxCell>
<!-- 重力 G(竖直向下) -->
<mxCell id="4" value="G" style="endArrow=block;endFill=1;html=1;strokeWidth=2;fontStyle=1;fontSize=13;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="205" y="270" as="sourcePoint"/><mxPoint x="205" y="360" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 支持力 N(垂直斜面向上,斜向) -->
<mxCell id="5" value="N" style="endArrow=block;endFill=1;html=1;strokeWidth=2;fontStyle=1;fontSize=13;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="205" y="220" as="sourcePoint"/><mxPoint x="155" y="134" as="targetPoint"/></mxGeometry>
</mxCell>电路图
元件用简化图形表示,导线用正交折线(edgeStyle=orthogonalEdgeStyle)。
<!-- 电源(用矩形 + 标注表示) -->
<mxCell id="2" value="电源" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;strokeWidth=1.5;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="100" y="160" width="60" height="40" as="geometry"/>
</mxCell>
<!-- 电阻 R₁ -->
<mxCell id="3" value="R₁" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;strokeWidth=1.5;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="260" y="80" width="60" height="30" as="geometry"/>
</mxCell>
<!-- 电阻 R₂ -->
<mxCell id="4" value="R₂" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;strokeWidth=1.5;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="260" y="240" width="60" height="30" as="geometry"/>
</mxCell>
<!-- 导线(电源上端 → R₁ 左端) -->
<mxCell id="5" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;strokeWidth=1.5;endArrow=none;" edge="1" parent="1" source="2" target="3">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- 导线(电源下端 → R₂ 左端) -->
<mxCell id="6" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;strokeWidth=1.5;endArrow=none;" edge="1" parent="1" source="2" target="4">
<mxGeometry relative="1" as="geometry"/>
</mxCell>串联电路(电源–开关–电阻–灯泡)
矩形回路,元件依次串在回路各边,导线用带折角的 endArrow=none 边(明确指定 waypoints)。
<!-- 电源(左侧,中心 x=100) -->
<mxCell id="2" value="电源" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;strokeWidth=1.5;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="75" y="175" width="50" height="60" as="geometry"/>
</mxCell>
<!-- "+" 标注 -->
<mxCell id="3" value="+" style="text;html=1;align=center;fontSize=14;fontStyle=1;fontColor=#D04A22;" vertex="1" parent="1">
<mxGeometry x="84" y="157" width="14" height="18" as="geometry"/>
</mxCell>
<!-- "−" 标注 -->
<mxCell id="4" value="−" style="text;html=1;align=center;fontSize=16;fontColor=#2060C0;" vertex="1" parent="1">
<mxGeometry x="84" y="235" width="14" height="18" as="geometry"/>
</mxCell>
<!-- 开关 K(上导线左段) -->
<mxCell id="5" value="开关 K" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;strokeWidth=1.5;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="190" y="60" width="70" height="30" as="geometry"/>
</mxCell>
<!-- 电阻 R(上导线右段) -->
<mxCell id="6" value="电阻 R" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFBE6;strokeColor=#CFC286;strokeWidth=1.5;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="315" y="60" width="70" height="30" as="geometry"/>
</mxCell>
<!-- 灯泡 L(右侧) -->
<mxCell id="7" value="灯泡 L" style="ellipse;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;strokeWidth=1.5;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="440" y="175" width="50" height="60" as="geometry"/>
</mxCell>
<!-- 导线1: 电源+ → 折角 → 开关K左 -->
<mxCell id="8" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="100" y="175" as="sourcePoint"/>
<mxPoint x="190" y="75" as="targetPoint"/>
<Array as="points"><mxPoint x="100" y="75"/></Array>
</mxGeometry>
</mxCell>
<!-- 导线2: 开关K右 → 电阻R左 -->
<mxCell id="9" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="260" y="75" as="sourcePoint"/>
<mxPoint x="315" y="75" as="targetPoint"/>
</mxGeometry>
</mxCell>
<!-- 导线3: 电阻R右 → 折角 → 灯泡L顶 -->
<mxCell id="10" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="385" y="75" as="sourcePoint"/>
<mxPoint x="465" y="175" as="targetPoint"/>
<Array as="points"><mxPoint x="465" y="75"/></Array>
</mxGeometry>
</mxCell>
<!-- 导线4: 灯泡L底 → 两个折角 → 电源− -->
<mxCell id="11" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="465" y="235" as="sourcePoint"/>
<mxPoint x="100" y="235" as="targetPoint"/>
<Array as="points"><mxPoint x="465" y="360"/><mxPoint x="100" y="360"/></Array>
</mxGeometry>
</mxCell>串联特性:同一条导线,电流处处相等($I = I_1 = I_2$);总电阻 $R = R_1 + R_2 + \cdots$。
并联电路(两支路:电阻 R₁‖灯泡 L)
左右两条纵向导线(分别在 x=660 / x=990),上下两条横向支路(分别在 y=90 / y=290)。结点用 8px 实心圆标出。
<!-- 电源(左侧,中心 x=660) -->
<mxCell id="2" value="电源" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;strokeWidth=1.5;fontSize=13;" vertex="1" parent="1">
<mxGeometry x="635" y="175" width="50" height="60" as="geometry"/>
</mxCell>
<!-- 电阻 R₁(上支路,y 中心=90) -->
<mxCell id="3" value="电阻 R₁" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFBE6;strokeColor=#CFC286;strokeWidth=1.5;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="760" y="75" width="80" height="30" as="geometry"/>
</mxCell>
<!-- 灯泡 L(下支路,y 中心=290) -->
<mxCell id="4" value="灯泡 L" style="ellipse;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;strokeWidth=1.5;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="760" y="275" width="80" height="30" as="geometry"/>
</mxCell>
<!-- 导线 A: 电源+ → 左上结点 -->
<mxCell id="5" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="660" y="175" as="sourcePoint"/><mxPoint x="660" y="90" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 导线 B: 左上结点 → R₁左 -->
<mxCell id="6" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="660" y="90" as="sourcePoint"/><mxPoint x="760" y="90" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 导线 C: R₁右 → 右上结点 -->
<mxCell id="7" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="840" y="90" as="sourcePoint"/><mxPoint x="990" y="90" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 导线 D: 右侧纵线(上结点 → 下结点) -->
<mxCell id="8" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="990" y="90" as="sourcePoint"/><mxPoint x="990" y="290" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 导线 E: 右下结点 → L右 -->
<mxCell id="9" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="990" y="290" as="sourcePoint"/><mxPoint x="840" y="290" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 导线 F: L左 → 左下结点 -->
<mxCell id="10" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="760" y="290" as="sourcePoint"/><mxPoint x="660" y="290" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 导线 G: 左下结点 → 电源− -->
<mxCell id="11" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="660" y="290" as="sourcePoint"/><mxPoint x="660" y="235" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 结点(Junction dots,4 个 T 形交叉处) -->
<mxCell id="12" value="" style="ellipse;aspect=fixed;fillColor=#000000;strokeColor=#000000;html=1;" vertex="1" parent="1">
<mxGeometry x="656" y="86" width="8" height="8" as="geometry"/>
</mxCell>
<mxCell id="13" value="" style="ellipse;aspect=fixed;fillColor=#000000;strokeColor=#000000;html=1;" vertex="1" parent="1">
<mxGeometry x="656" y="286" width="8" height="8" as="geometry"/>
</mxCell>
<mxCell id="14" value="" style="ellipse;aspect=fixed;fillColor=#000000;strokeColor=#000000;html=1;" vertex="1" parent="1">
<mxGeometry x="986" y="86" width="8" height="8" as="geometry"/>
</mxCell>
<mxCell id="15" value="" style="ellipse;aspect=fixed;fillColor=#000000;strokeColor=#000000;html=1;" vertex="1" parent="1">
<mxGeometry x="986" y="286" width="8" height="8" as="geometry"/>
</mxCell>并联特性:各支路电压相等($U = U_1 = U_2$);总电流 $I = I_1 + I_2$;总电阻 $\frac{1}{R} = \frac{1}{R_1} + \frac{1}{R_2}$。
电流表与电压表位置
- 电流表 A:串联在被测支路中,替换任意一段导线(在该段两端插入电流表矩形,替换原来那段导线)
- 电压表 V:并联在被测元件两端,从元件两侧各引一根导线接到 V 的两端
<!-- 电流表 A(示例:串在上支路) -->
<mxCell id="20" value="A" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;strokeWidth=1.5;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="690" y="77" width="36" height="36" as="geometry"/>
</mxCell>
<!-- 电压表 V(示例:并在 R₁ 两端) -->
<mxCell id="21" value="V" style="ellipse;aspect=fixed;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;strokeWidth=1.5;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="794" y="140" width="36" height="36" as="geometry"/>
</mxCell>
<!-- V 并联导线(从 R₁ 左端引到 V,从 V 引到 R₁ 右端) -->
<mxCell id="22" value="" style="edgeStyle=orthogonalEdgeStyle;endArrow=none;html=1;strokeWidth=1;dashed=1;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="760" y="90" as="sourcePoint"/><mxPoint x="812" y="140" as="targetPoint"/></mxGeometry>
</mxCell>
<mxCell id="23" value="" style="edgeStyle=orthogonalEdgeStyle;endArrow=none;html=1;strokeWidth=1;dashed=1;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="840" y="90" as="sourcePoint"/><mxPoint x="812" y="176" as="targetPoint"/></mxGeometry>
</mxCell>光路图
<!-- 介质分界面(水平线) -->
<mxCell id="2" value="" style="endArrow=none;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="60" y="240" as="sourcePoint"/><mxPoint x="440" y="240" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 法线(虚线,垂直于界面) -->
<mxCell id="3" value="法线" style="endArrow=none;dashed=1;html=1;strokeWidth=1;strokeColor=#666666;fontSize=12;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="240" y="80" as="sourcePoint"/><mxPoint x="240" y="400" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 入射光线(左上 → 界面交点) -->
<mxCell id="4" value="入射光" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;fontSize=12;labelPosition=left;align=right;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="80" y="100" as="sourcePoint"/><mxPoint x="240" y="240" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 折射光线(界面交点 → 右下,折向法线) -->
<mxCell id="5" value="折射光" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;fontSize=12;labelPosition=right;align=left;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="240" y="240" as="sourcePoint"/><mxPoint x="360" y="400" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 反射光线(界面交点 → 右上) -->
<mxCell id="6" value="反射光" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;fontSize=12;labelPosition=right;align=left;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="240" y="240" as="sourcePoint"/><mxPoint x="400" y="100" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 入射角标注(弧线用文字代替) -->
<mxCell id="7" value="θ₁" style="text;html=1;fontSize=14;fontStyle=2;" vertex="1" parent="1">
<mxGeometry x="218" y="180" width="30" height="24" as="geometry"/>
</mxCell>
<!-- 折射角标注 -->
<mxCell id="8" value="θ₂" style="text;html=1;fontSize=14;fontStyle=2;" vertex="1" parent="1">
<mxGeometry x="250" y="268" width="30" height="24" as="geometry"/>
</mxCell>运动轨迹图
<!-- 抛体运动轨迹(用曲线近似,多段折线) -->
<mxCell id="2" value="" style="curved=1;endArrow=open;endFill=0;html=1;strokeWidth=1.5;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="80" y="200" as="sourcePoint"/>
<mxPoint x="400" y="360" as="targetPoint"/>
<Array as="points"><mxPoint x="160" y="120"/><mxPoint x="240" y="100"/><mxPoint x="320" y="160"/></Array>
</mxGeometry>
</mxCell>
<!-- 初速度箭头 v₀ -->
<mxCell id="3" value="v₀" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;fontStyle=1;fontSize=13;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="80" y="200" as="sourcePoint"/><mxPoint x="160" y="160" as="targetPoint"/></mxGeometry>
</mxCell>从零生成图表
在无参考图的情况下,根据用户需求(模型架构、算法流程、概念示意等)从零生成 .drawio 图表。
使用时机
- 用户需要为深度学习模型(如 Transformer、CNN、RNN 等)生成架构图
- 用户需要绘制算法流程图、数据流图、系统架构图
- 用户需要可视化特定概念(如感受野、注意力机制、特征提取过程等)
- 用户提到「画个图」「生成架构图」「可视化模型结构」「绘制流程图」等需求
工作流程
Step 1:需求分析
1. 确定图表类型:
- 模型架构图(Transformer、CNN、RNN、GAN 等)
- 算法流程图(前向传播、训练流程、推理流程)
- 概念示意图(感受野、注意力机制、特征金字塔)
- 系统架构图(多模块交互、数据流)
2. 提取关键信息:
- 如果有代码:分析类结构、forward 方法、层堆叠关系
- 如果是概念图:确定需要展示的核心要素
Step 2:设计布局
1. 选择布局方向:
- 自下而上:适合数据流图、前向传播
- 自上而下:适合层次结构、决策流程
- 自左向右:适合时序展开、编码-解码结构
- 中心发散:适合注意力机制、多分支结构
2. 规划元素位置:
- 计算画布大小(通常 800-1200 宽,600-1000 高)
- 为每个模块预留空间(节点间距至少 20-30px)
- 考虑残差连接、跳跃连接的路径
Step 3:生成 XML(关键)
严格按照以下模板生成,避免标签错误:
<mxfile host="app.diagrams.net">
<diagram name="图表名称" id="唯一id">
<mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="900" pageHeight="800" background="#F5F5DC">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<!-- 2D 节点示例 -->
<mxCell id="2" value="节点标签" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#F4CCCC;strokeColor=#333333;strokeWidth=1;fontSize=11" vertex="1" parent="1">
<mxGeometry x="100" y="100" width="150" height="40" as="geometry"/>
</mxCell>
<!-- 3D 节点示例 (用于表示特征图、卷积层等立体结构) -->
<mxCell id="3" value="" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;size=20;fillColor=#B3D9E6;strokeColor=#333333;strokeWidth=1.5" vertex="1" parent="1">
<mxGeometry x="300" y="50" width="50" height="140" as="geometry"/>
</mxCell>
<!-- 3D 节点的文本标签 (通常放置于图形下方独立对齐) -->
<mxCell id="3_label" value="Conv" style="text;html=1;align=center;verticalAlign=middle;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="295" y="200" width="60" height="20" as="geometry"/>
</mxCell>
<!-- 连线示例 -->
<mxCell id="4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;strokeColor=#000000;strokeWidth=2;endArrow=classic" edge="1" parent="1" source="2" target="3">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>生成过程中的检查清单:
- [ ] 每个
<mxCell>都有对应的</mxCell>(不是</mCell>或其他) - [ ]
vertex="1"用于节点,edge="1"用于连线 - [ ] 所有 ID 唯一且连续(0, 1, 2, 3, ...)
- [ ] 连线的
source和target指向存在的节点 ID - [ ] 文本中的特殊字符已转义(
<、>、&) - [ ] 所有元素都有
parent="1"(除了根元素 0 和 1)
Step 4:添加辅助元素
1. 标注文本:输入/输出标签、参数说明框、操作说明(如 "× N")、公式或维度标注 2. 视觉增强:分组容器框、残差连接(虚线箭头)、颜色区分不同类型的层
Step 5:输出与说明
图表说明、使用指南、图题和论文引用示例。
标准配色方案(学术风格)
- 背景色:
#F5F5DC - 输入/嵌入层:
#F4CCCC - 卷积/变换层:
#B3D9E6 - 注意力层:
#F4CCCC - 归一化层:
#FFEB99 - 前馈网络/MLP:
#B3D9E6 - 输出层:
#B6D7A8 - 特殊操作:
#E6E6FA - 拼接/融合:
#FFD966 - 参数说明框:
#FFF9E6
常见图表类型模板
Transformer 编码器/解码器
结构:Input Embedding + PE、Multi-Head Attention、Add & Norm、FFN、残差连接、× N 层。布局:自下而上,左右分列。
CNN 架构图
结构:输入图像、Conv+BN+Act、池化、特征图维度、全连接、输出。布局:自左向右。
感受野示意图
结构:多层特征图网格、感受野高亮、计算公式框、参数说明。布局:横向并列。
注意力机制图
结构:Q/K/V、矩阵乘法、Softmax、加权求和、注意力权重可视化。布局:自下而上或流程图式。
质量保证
- 生成前:准确理解代码/概念,确定图表类型
- 生成后:XML 语法检查、逻辑完整性(连线、ID)、视觉效果(不重叠、间距合理)
输出模板
图表说明、核心组件、设计风格、文件信息、使用说明、论文引用示例。详见主 SKILL 输出模板。
常见问题
- "Not a diagram file":检查
<mxfile>、host、嵌套关系 - "Opening and ending tag mismatch":确保
</mxCell>正确闭合 - 节点/连线不显示:检查
vertex/edge、parent、source/target - 中文乱码:UTF-8 编码,特殊字符转义
注意事项
1. 连线使用 edgeStyle=orthogonalEdgeStyle 自动布线 2. ID 按生成顺序递增 3. 文本换行用 <br> 4. 保持学术风格简洁 5. 宽度建议不超过 800-1000px
图表风格迁移
在用户提供参考图的前提下,结合内容来源(当前项目代码、或用户文字描述),生成一张风格与参考图一致的新图表。
使用时机
- 用户上传或贴出一张图,并希望「按这张图的风格」画一张新图
- 内容来源可以是:当前项目/代码,或用户提供的文字描述
- 用户提到「风格迁移」「按这个风格画」「参考这张图的样式」「照着这个排版/配色画」
输入方式
| 输入 | 说明 |
|---|---|
| 参考图 | 必选。用户上传的图片,或提供图片路径/链接 |
| 内容描述 | 二选一。用户用文字描述新图应包含的节点、层次、关系等 |
| 项目路径 | 二选一。从当前项目/代码中抽取内容 |
若仅提供参考图而无内容描述或项目,应追问用户希望新图展示什么内容。
工作流程
Step 1:分析参考图风格
提取:配色、布局方向、形状类型、分组方式、字体与字号、连线样式。整理为「风格摘要」。
Step 2:获取图表内容
方式 A:从用户描述解析节点、层次、关系 方式 B:从当前项目抽取技术栈、架构、数据结构、E-R 等
确保内容 100% 来自用户描述或项目,不照抄参考图中的业务名称。
Step 3:风格与内容对齐
用参考图的布局方向、分组方式、配色、节点形状、连线样式组织内容。
Step 4:生成 .drawio 文件
生成完整 mxGraph XML,内容来自用户/项目,风格来自参考图。
Step 5:输出说明
风格摘要、内容来源说明、Draw.io 文件内容、使用说明、图题建议。
注意事项
- 只迁移风格,不迁移参考图中的业务名称
- 风格优先:参考图与通用规范冲突时以参考图为准
技术图与模型架构图生成规范
在无参考图的情况下,根据用户需求生成专业、可编辑、可用于论文或技术文档的 .drawio 图表。优先保证信息层次清楚、视觉统一、审稿人能快速读懂核心结构。
使用时机
- 用户需要为深度学习模型(如 Transformer、CNN、RNN 等)生成架构图
- 用户需要绘制算法流程图、数据流图、系统架构图
- 用户需要可视化特定概念(如感受野、注意力机制、特征金字塔)
- 用户提到「画个图」「生成架构图」「可视化模型结构」「绘制流程图」等需求
工作流程
Step 1:明确图的核心信息
1. 确定图表类型:
- 模型架构图:突出模块层级、数据流、重复结构和关键连接
- 算法流程图:突出步骤顺序、输入输出、条件分支
- 概念示意图:突出关键变量、计算关系、局部机制
- 系统架构图:突出模块职责、数据/控制流、边界
2. 提取必要内容:
- 有代码时,优先分析类结构、
forward方法、层堆叠关系和张量流向 - 无代码时,从用户描述中提取节点、层次、连接、重复次数和输入输出
- 不确定的结构不要凭空补全;影响图意的假设需要在输出说明中标注
Step 2:先设计布局,再写 XML
1. 选择布局方向:
- 自下而上:适合神经网络前向传播、编码器/解码器堆叠
- 自上而下:适合步骤流程、决策流程、训练流程
- 自左向右:适合时序展开、多阶段 pipeline、特征提取链路
- 中心发散:适合注意力机制、多分支融合、模块内部机制
2. 控制专业版式:
- 画布建议
1400-1800宽、900-1200高;复杂图可使用page="0"的自由画布 - 主模块宽度建议
300-420px,高度56-72px;不要使用过小的 11px 字号 - 主标题
28-32px,模块标题24-26px,说明文字18-20px - 模块间距至少
28-40px;分组容器内边距至少40px - 同一列内所有模块必须使用相同的 x 坐标和相同的宽度,不能宽窄混用;以容器中心居中,左右内边距各留 50-60px
- 编码器/解码器、Backbone/Neck/Head 等并列结构要对齐基线和中心线
- 残差、跳连、跨模块连接走外侧,避免穿过主节点
Step 3:使用统一的学术图样式
参考浅色学术配色,避免高饱和、杂乱或默认 Draw.io 风格。
| 元素 | 推荐样式 |
|---|---|
| 页面 | grid="0",优先白色或透明背景 |
| 分组容器 | rounded=1;arcSize=10;strokeWidth=3;fillColor=#FFFCFF;strokeColor=#B7E0FF |
| 普通模块 | rounded=1;arcSize=10;strokeWidth=2;fillColor=#FCF7FF;strokeColor=#666666 |
| 注意力/关键计算 | fillColor=#EBDFF2;strokeColor=#9673A6 |
| 前馈/卷积/变换层 | fillColor=#FFFBE6;strokeColor=#CFC286 |
| 归一化/融合 | fillColor=#C9E9D2;strokeColor=#67AB9F |
| 输入/嵌入 | fillColor=#FAE2D4;strokeColor=#B89E8A |
| 输出/预测 | fillColor=#B7E0FF;strokeColor=#6C8EBF |
| 说明框 | fillColor=#FFFBE6;strokeColor=#CFC286 |
| 主连线 | edgeStyle=orthogonalEdgeStyle;rounded=0;strokeColor=#000000;strokeWidth=2;endArrow=classic |
| 残差/辅助连线 | 主连线基础上加 dashed=1;dashPattern=8 6;strokeColor=#666666 |
Step 4:生成 XML(关键)
优先生成未压缩、可读的 Draw.io XML,便于后续人工编辑和版本对比。
<mxfile host="app.diagrams.net">
<diagram name="图表名称" id="diagram-id">
<mxGraphModel dx="1600" dy="1000" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="1600" pageHeight="1000" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="2" value="模块名称" style="rounded=1;arcSize=10;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#FCF7FF;strokeColor=#666666;fontColor=#333333;" vertex="1" parent="1">
<mxGeometry x="100" y="100" width="360" height="64" as="geometry"/>
</mxCell>
<mxCell id="4" value="下游模块" style="rounded=1;arcSize=10;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#FFFBE6;strokeColor=#CFC286;fontColor=#333333;" vertex="1" parent="1">
<mxGeometry x="100" y="220" width="360" height="64" as="geometry"/>
</mxCell>
<mxCell id="3" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;strokeColor=#000000;strokeWidth=2;endArrow=classic;" edge="1" parent="1" source="2" target="4">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>生成过程中的检查清单:
- [ ] 每个
<mxCell>都有对应的</mxCell>,不能写成</mCell> - [ ] 节点使用
vertex="1",连线使用edge="1" - [ ] 所有 ID 唯一,连线的
source和target指向存在节点 - [ ] 文本中的特殊字符已转义:
&、<、>分别写成&、<、> - [ ] 所有普通元素都有
parent="1",根元素除外 - [ ] 节点不重叠,连线不穿过关键文字,外侧跳连留足空间
- [ ] 同类节点的宽高、字号、圆角、描边保持一致
- [ ]
value里的富文本直接写<font style="...">原始标签,不要预先写成<font>——由 XML 序列化做唯一一次转义;否则 Draw.io 会把标签当纯文字显示 - [ ] 分组容器的底边/顶边必须留出至少 30px 内边距,确保最靠近边界的节点完全在容器内而不越界
Step 5:添加辅助表达
1. 重复结构:使用 x N、N layers 或分组标题表示,不要机械复制多层导致图拥挤。 2. 残差连接:用外侧虚线箭头表达,落点指向 Add + Norm 或融合节点。 3. 跨模块信息流:如 Encoder Memory 到 Cross-Attention,应使用清晰的横向正交箭头,并添加说明框。 4. 维度/参数标注:只标关键维度,避免把论文公式全部塞进节点。 5. 标题与图注:标题和图注放在图的下方(y 坐标大于最低节点底边 + 30px),不放顶部,符合论文图题惯例。
常见图表模板
Transformer 编码器/解码器
结构:输入嵌入与位置编码、Multi-Head Self-Attention、Add + LayerNorm、FFN、Decoder Masked Attention、Encoder-Decoder Cross-Attention、Linear + Softmax、残差连接、x N 重复层。布局优先左右分列,Encoder 在左、Decoder 在右,数据流自下而上,Encoder Memory 横向输入 Cross-Attention。
CNN / 检测网络架构图
结构:Input、Backbone、Neck、Head、Prediction,可按阶段从左到右展开。复杂模块用容器概括,模块内部只展示对理解贡献最大的算子。
感受野示意图
结构:多层特征图网格、感受野高亮、计算公式框、参数说明。布局横向并列,颜色只强调被解释区域。
注意力机制图
结构:Q/K/V、矩阵乘法、Scale、Softmax、加权求和、输出。布局可以自下而上或左到右,矩阵和向量要对齐,避免箭头交叉。
质量标准
- 内容准确:图中每个模块都能追溯到用户描述、论文结构或代码实现。
- 层次清晰:主路径、辅助路径、重复结构一眼可分辨。
- 视觉统一:同类模块同色、同尺寸、同字号,连线样式一致。
- 审稿友好:字号足够大,图形留白充足,避免装饰性元素压过模型结构。
- 可维护:输出未压缩 XML,后续可在 Draw.io 中继续编辑。
输出模板
输出时说明:图表说明、核心组件、布局与配色、文件位置、Draw.io 打开方式、论文图题建议。
常见问题
- "Not a diagram file":检查
<mxfile>、<diagram>、<mxGraphModel>的嵌套关系 - "Opening and ending tag mismatch":确保所有 XML 标签闭合正确
- 节点/连线不显示:检查
vertex/edge、parent、source/target - 中文乱码:使用 UTF-8 编码,特殊字符按 XML 规则转义
- 图看起来不专业:优先检查字号是否过小、模块是否拥挤、颜色是否过多、连线是否穿过主体
UML 时序图(Sequence Diagram)
技术文档与系统设计中的 UML 时序图:参与者、生命线、激活条、同步/异步消息、返回消息。
使用时机
- 用户需要绘制系统交互流程(登录、支付、消息推送等)
- 用户提到「时序图」「UML」「Sequence Diagram」「交互流程图」「消息流」等关键词
- 用户需要展示多个对象/服务之间的调用顺序和返回关系
通用规范
- 背景白色
background="#FFFFFF",画布宽度根据参与者数量调整(每增加一个参与者 +170px) - 生命线(Lifeline):参与者头部底边向下延伸的垂直虚线,颜色
#999999,线宽 1 - 激活条(Activation Bar):宽 14px,高度覆盖活跃调用期,颜色与参与者头部一致
- 消息类型:
- 同步调用(→):
endArrow=block;endFill=1,实线黑色 - 返回消息(--▶):
endArrow=open;endFill=0;dashed=1,虚线灰色#555555 - 异步消息(⇢):
endArrow=open;endFill=0,实线(半箭头)
坐标规则
- 参与者头部高度:40px,顶部留白 20px,所以头部底边 y=60
- 生命线从 y=60 延伸到画布底部(留 60px 给图题)
- 激活条:
x = lifeline_x − 7,宽 14px - 消息 sourceX:出发方激活条右边界
lifeline_x + 7 - 消息 targetX:目标方激活条左边界
target_lifeline_x − 7 - 消息垂直间距建议 40–50px(避免标签重叠)
- 返回消息 y 比同组调用消息 y 大 40–50px
元素模板
参与者头部(Actor Box)
<mxCell id="2" value="Client" style="rounded=1;arcSize=15;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;strokeWidth=1.5;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="20" width="120" height="40" as="geometry"/>
</mxCell>生命线(垂直虚线)
<mxCell id="10" value="" style="endArrow=none;dashed=1;html=1;strokeWidth=1;strokeColor=#999999;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="120" y="60" as="sourcePoint"/>
<mxPoint x="120" y="460" as="targetPoint"/>
</mxGeometry>
</mxCell>生命线 x = 参与者头部中心 x = 头部左边距 + 宽度/2。
激活条(Activation Bar)
<mxCell id="20" value="" style="rounded=0;fillColor=#DAE8FC;strokeColor=#6C8EBF;strokeWidth=1;html=1;" vertex="1" parent="1">
<mxGeometry x="113" y="95" width="14" height="200" as="geometry"/>
</mxCell>同步消息(Synchronous Call)
<mxCell id="30" value="消息名称" style="endArrow=block;endFill=1;html=1;strokeWidth=1.5;strokeColor=#000000;fontSize=12;labelPosition=center;verticalLabelPosition=bottom;align=center;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="127" y="115" as="sourcePoint"/>
<mxPoint x="283" y="115" as="targetPoint"/>
</mxGeometry>
</mxCell>返回消息(Return, 虚线箭头)
<mxCell id="31" value="返回值" style="endArrow=open;endFill=0;dashed=1;html=1;strokeWidth=1.5;strokeColor=#555555;fontSize=12;labelPosition=center;verticalLabelPosition=bottom;align=center;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="283" y="200" as="sourcePoint"/>
<mxPoint x="127" y="200" as="targetPoint"/>
</mxGeometry>
</mxCell>异步消息(Asynchronous, 半箭头)
<mxCell id="32" value="async event" style="endArrow=open;endFill=0;html=1;strokeWidth=1.5;strokeColor=#000000;fontSize=12;labelPosition=center;verticalLabelPosition=bottom;align=center;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="127" y="150" as="sourcePoint"/>
<mxPoint x="283" y="150" as="targetPoint"/>
</mxGeometry>
</mxCell>颜色配色建议
| 参与者类型 | fillColor | strokeColor |
|---|---|---|
| 前端 / 客户端 | #DAE8FC | #6C8EBF |
| 后端 / API 网关 | #D5E8D4 | #82B366 |
| 业务服务 | #FFF2CC | #D6B656 |
| 数据库 | #F8CECC | #B85450 |
| 外部系统 | #E1D5E7 | #9673A6 |
| 消息队列 | #FCF7FF | #666666 |
完整示例:用户登录时序图
参与者:Client(120)→ API Gateway(290)→ Auth Service(470)→ Database(650)
<mxfile host="app.diagrams.net">
<diagram name="UML时序图-登录流程" id="uml-seq-login">
<mxGraphModel dx="1000" dy="600" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="900" pageHeight="520" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<!-- 参与者头部 -->
<mxCell id="2" value="Client" style="rounded=1;arcSize=15;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;strokeWidth=1.5;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="60" y="20" width="120" height="40" as="geometry"/>
</mxCell>
<mxCell id="3" value="API Gateway" style="rounded=1;arcSize=15;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;strokeWidth=1.5;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="230" y="20" width="120" height="40" as="geometry"/>
</mxCell>
<mxCell id="4" value="Auth Service" style="rounded=1;arcSize=15;whiteSpace=wrap;html=1;fillColor=#FFF2CC;strokeColor=#D6B656;strokeWidth=1.5;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="400" y="20" width="140" height="40" as="geometry"/>
</mxCell>
<mxCell id="5" value="Database" style="rounded=1;arcSize=15;whiteSpace=wrap;html=1;fillColor=#F8CECC;strokeColor=#B85450;strokeWidth=1.5;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="590" y="20" width="120" height="40" as="geometry"/>
</mxCell>
<!-- 生命线(垂直虚线) -->
<mxCell id="6" value="" style="endArrow=none;dashed=1;html=1;strokeWidth=1;strokeColor=#999999;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="120" y="60" as="sourcePoint"/><mxPoint x="120" y="460" as="targetPoint"/></mxGeometry>
</mxCell>
<mxCell id="7" value="" style="endArrow=none;dashed=1;html=1;strokeWidth=1;strokeColor=#999999;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="290" y="60" as="sourcePoint"/><mxPoint x="290" y="460" as="targetPoint"/></mxGeometry>
</mxCell>
<mxCell id="8" value="" style="endArrow=none;dashed=1;html=1;strokeWidth=1;strokeColor=#999999;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="470" y="60" as="sourcePoint"/><mxPoint x="470" y="460" as="targetPoint"/></mxGeometry>
</mxCell>
<mxCell id="9" value="" style="endArrow=none;dashed=1;html=1;strokeWidth=1;strokeColor=#999999;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="650" y="60" as="sourcePoint"/><mxPoint x="650" y="460" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 激活条 -->
<mxCell id="10" value="" style="rounded=0;fillColor=#DAE8FC;strokeColor=#6C8EBF;strokeWidth=1;html=1;" vertex="1" parent="1">
<mxGeometry x="113" y="95" width="14" height="275" as="geometry"/>
</mxCell>
<mxCell id="11" value="" style="rounded=0;fillColor=#D5E8D4;strokeColor=#82B366;strokeWidth=1;html=1;" vertex="1" parent="1">
<mxGeometry x="283" y="115" width="14" height="215" as="geometry"/>
</mxCell>
<mxCell id="12" value="" style="rounded=0;fillColor=#FFF2CC;strokeColor=#D6B656;strokeWidth=1;html=1;" vertex="1" parent="1">
<mxGeometry x="463" y="165" width="14" height="125" as="geometry"/>
</mxCell>
<mxCell id="13" value="" style="rounded=0;fillColor=#F8CECC;strokeColor=#B85450;strokeWidth=1;html=1;" vertex="1" parent="1">
<mxGeometry x="643" y="215" width="14" height="50" as="geometry"/>
</mxCell>
<!-- 消息(序号写在 value 里,省去额外标注元素) -->
<mxCell id="14" value="① POST /login" style="endArrow=block;endFill=1;html=1;strokeWidth=1.5;strokeColor=#000000;fontSize=12;labelPosition=center;verticalLabelPosition=bottom;align=center;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="127" y="115" as="sourcePoint"/><mxPoint x="283" y="115" as="targetPoint"/></mxGeometry>
</mxCell>
<mxCell id="15" value="② validate(credentials)" style="endArrow=block;endFill=1;html=1;strokeWidth=1.5;strokeColor=#000000;fontSize=12;labelPosition=center;verticalLabelPosition=bottom;align=center;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="297" y="165" as="sourcePoint"/><mxPoint x="463" y="165" as="targetPoint"/></mxGeometry>
</mxCell>
<mxCell id="16" value="③ SELECT user" style="endArrow=block;endFill=1;html=1;strokeWidth=1.5;strokeColor=#000000;fontSize=12;labelPosition=center;verticalLabelPosition=bottom;align=center;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="477" y="215" as="sourcePoint"/><mxPoint x="643" y="215" as="targetPoint"/></mxGeometry>
</mxCell>
<mxCell id="17" value="④ user record" style="endArrow=open;endFill=0;dashed=1;html=1;strokeWidth=1.5;strokeColor=#555555;fontSize=12;labelPosition=center;verticalLabelPosition=bottom;align=center;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="643" y="260" as="sourcePoint"/><mxPoint x="477" y="260" as="targetPoint"/></mxGeometry>
</mxCell>
<mxCell id="18" value="⑤ JWT token" style="endArrow=open;endFill=0;dashed=1;html=1;strokeWidth=1.5;strokeColor=#555555;fontSize=12;labelPosition=center;verticalLabelPosition=bottom;align=center;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="463" y="300" as="sourcePoint"/><mxPoint x="297" y="300" as="targetPoint"/></mxGeometry>
</mxCell>
<mxCell id="19" value="⑥ 200 OK + JWT" style="endArrow=open;endFill=0;dashed=1;html=1;strokeWidth=1.5;strokeColor=#555555;fontSize=12;labelPosition=center;verticalLabelPosition=bottom;align=center;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry"><mxPoint x="283" y="345" as="sourcePoint"/><mxPoint x="127" y="345" as="targetPoint"/></mxGeometry>
</mxCell>
<!-- 图题 -->
<mxCell id="20" value="图:用户登录时序图(Login Sequence Diagram)" style="text;html=1;align=center;fontSize=13;fontStyle=2;" vertex="1" parent="1">
<mxGeometry x="150" y="472" width="500" height="24" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>质量检查清单
- [ ] 生命线 x 坐标与参与者头部中心对齐
- [ ] 激活条 x = lifeline_x − 7
- [ ] 消息箭头水平(同一行),y 坐标在激活条起始 y 内
- [ ] 返回消息用虚线,调用消息用实线实心箭头
- [ ] 消息标签不重叠(y 间距 ≥ 40px)
- [ ] 图题在最下方(y > 最低元素底边 + 20px)
- [ ] 所有 ID 唯一,无重复