graphviz 画流程图

brew install graphviz
vi lz.dot

dot -Tjpg lz3.dot -o lz3.jpg

dot语法
无向图: - -
有向图:- >
属性:节点和边显示样式(颜色、形状、线形); 用[key=value,]表示
注释://单行注释; #注释此行 ; /***/多行注释

属性
label=“123” 节点标签,替换节点默认名称
shape=box 节点形状()
style=filled 样式 (filled 填充 dashed)
fontcolor=red 字体颜色
color=yellow 节点配色
fontname=Courier 字体
penwidth=1.0 线条宽度

//
nodesep=1.0 节点间距
node [color=Red,] # 所有节点属性配置
edge [color=Blue,] # 所有边属性配置

图像属性
label="My Graph"; # 给图像设置标签
rankdir=LR; # 从左到右布局
a->{b c d} # a 分别指向b c d 节点
{rank=same; a, b, c } # 将一组元素放到同一个level 将abc节点放置同一水平
splines="line"; # 让边框变为直线,没有曲线和锐角
K=0.6; # 在布局中影响spring属性,spring属性用于将节点往外推,在twopi和sfdp布局中很有用。
bgcolor 背景颜色
concentrate = false 让多条边有公共部分
nodesep = .25 节点之间的间隔(英寸)
peripheries = 1 边界数
rank (same,min,source, max,sink)设置多个节点顺序
rankdir = TB 排序方向
ranksep = .75 间隔
size 图的大小(英寸)

译注:暂时还没明白这个spring属性应该怎么翻,初步猜测是弹性。

交点属性
[label="Some Label"] # 给交点打标签
[color="red"] # 给交点上色
[fillcolor="blue"] # 设置交点的填充色
shape ellipse 形状
sides 4 当shape=polygon时的边数
fillcolor lightgrey/black 填充颜色
fixedsize false 标签是否影响节点的大小

边的属性
[label="Some Label"] # 给边设置标签 (设置路径权重的时候很有用)
[color="red"] # 给交点上色 (标示路径的时候很有用)
[penwidth=2.0] # 给边适配厚度,标示路径的时候很有用。
arrowhead = normal # 箭头头部形状
arrowsize = 1.0 # 箭头大小
arrowtail = normal # 箭头尾部形状
constraint=true #是否根据边来影响节点的排序
decorate #设置之后会用一条线来连接edge和label
dir=forward # 设置方向:forward,back,both,none
headclip=true # 是否到边界为止
tailclip=true #与headclip类似

尺寸, 背景颜色
fixedsize=true;
size="1,1";
resolution=72;
bgcolor="#C6CFD532";

eg
digraph structs {
node[shape=record]
struct1 [label=" left| mid\ dle| right"];
struct2 [label="{ one| two\n\n\n}" shape=Mrecord];
struct3 [label="hello\nworld |{ b |{c| d|e}| f}| g | h"];
struct1:f1 -> struct2:f0;
struct1:f0 -> struct3:f1;
}

dot 语言 三种对象:图表、结点、边缘
digraph 可控制的
graph 不可控制
subgraph 子图表

绘制属性:

形状:多边形和纪录
box盒子 ,
polygon多边形 ,
ellipse椭圆,
oval椭圆,
circle圆,
point ,
egg卵形,
triangle三角 ,
plaintext ,
diamond菱形 ,
trapezium梯形 ,
parallelogram平行四边形 ,
house ,
pentagon五角形 ,
hexagon六角形 ,
septagon ,
octagon八边形 ,
doublecircle ,
doubleoctagon ,
tripleoctagon

你可能感兴趣的:(graphviz 画流程图)