[笔记]常用viz标记
说明
一、箭头样式(最常用)
digraph G {
A -> B; // 普通实线箭头
A -> B [style=dashed]; // 虚线箭头 ✔
A -> B [style=dotted]; // 点线箭头 ✔
A -> B [style=bold]; // 粗线箭头 ✔
A -> B [penwidth=2.5]; // 自定义粗细(数字越大越粗)
}
二、线条完整 style 清单
A -> B [style=solid]; // 实线(默认)
A -> B [style=dashed]; // 虚线
A -> B [style=dotted]; // 点线
A -> B [style=bold]; // 粗线
A -> B [style=rounded]; // 圆角拐角
A -> B [style=invis]; // 隐藏线条(占位)
三、线条粗细(penwidth)
A -> B [penwidth=1]; // 细(默认)
A -> B [penwidth=2]; // 中粗
A -> B [penwidth=3]; // 很粗
A -> B [penwidth=5]; // 超粗
四、箭头形状(arrowhead /arrowtail)
A -> B [arrowhead=normal]; // 标准箭头
A -> B [arrowhead=dot]; // 圆点箭头
A -> B [arrowhead=diamond]; // 菱形箭头
A -> B [arrowhead=obox]; // 方框箭头
A -> B [arrowhead=none]; // 无箭头
A -> B [arrowhead=vee]; // 尖箭头
A -> B [arrowhead=curve]; // 弯箭头
五、节点(方框)样式
digraph G {
node [shape=box, style=filled, fillcolor=lightblue]; // 统一设置所有节点
A [shape=ellipse]; // 椭圆(默认)
B [shape=box]; // 矩形
C [shape=circle]; // 圆形
D [shape=diamond]; // 菱形
E [shape=record]; // 多格记录框
F [shape=note]; // 便签样式
G [style=filled]; // 填充
H [fillcolor=yellow]; // 填充颜色
I [color=red]; // 边框颜色
J [fontsize=14]; // 文字大小
}
六、颜色(直接用英文)
A -> B [color=red];
A -> B [color=blue];
A -> B [color=green];
A -> B [color=gray];
A -> B [color=orange];
A -> B [color=pink];
A -> B [color=purple];
七、组合样式(直接复制用)
- 虚线 + 蓝色 + 中等粗细
A -> B [style=dashed, color=blue, penwidth=2]; - 粗线 + 红色
A -> B [style=bold, color=red]; - 点线 + 灰色 + 细
A -> B [style=dotted, color=gray, penwidth=1]; - 无箭头线条
A -> B [arrowhead=none];