graphviz 畫流程圖
brew install graphviz
vi lz.dot
dot -Tjpg lz3.dot -o lz3.jpg
dot語法
無向圖: - -
有向圖:- >
屬性:節(jié)點和邊顯示樣式(顏色沐兵、形狀雇逞、線形)泽论; 用[key=value,]表示
注釋://單行注釋鸵膏; #注釋此行 创千; /***/多行注釋
屬性
label=“123” 節(jié)點標簽悼做,替換節(jié)點默認名稱
shape=box 節(jié)點形狀()
style=filled 樣式 (filled 填充 dashed)
fontcolor=red 字體顏色
color=y(tǒng)ellow 節(jié)點配色
fontname=Courier 字體
penwidth=1.0 線條寬度
//
nodesep=1.0 節(jié)點間距
node [color=Red,] # 所有節(jié)點屬性配置
edge [color=Blue,] # 所有邊屬性配置
圖像屬性
label="My Graph"; # 給圖像設(shè)置標簽
rankdir=LR; # 從左到右布局
a->{b c d} # a 分別指向b c d 節(jié)點
{rank=same; a, b, c } # 將一組元素放到同一個level 將abc節(jié)點放置同一水平
splines="line"; # 讓邊框變?yōu)橹本€,沒有曲線和銳角
K=0.6; # 在布局中影響spring屬性兴喂,spring屬性用于將節(jié)點往外推,在twopi和sfdp布局中很有用焚志。
bgcolor 背景顏色
concentrate = false 讓多條邊有公共部分
nodesep = .25 節(jié)點之間的間隔(英寸)
peripheries = 1 邊界數(shù)
rank (same,min,source, max,sink)設(shè)置多個節(jié)點順序
rankdir = TB 排序方向
ranksep = .75 間隔
size 圖的大幸旅浴(英寸)
文/wsztrush(簡書作者)
原文鏈接:http://www.reibang.com/p/5b02445eca1d
著作權(quán)歸作者所有,轉(zhuǎn)載請聯(lián)系作者獲得授權(quán)酱酬,并標注“簡書作者”壶谒。
譯注:暫時還沒明白這個spring屬性應(yīng)該怎么翻,初步猜測是彈性膳沽。
交點屬性
[label="Some Label"] # 給交點打標簽
[color="red"] # 給交點上色
[fillcolor="blue"] # 設(shè)置交點的填充色
shape ellipse 形狀
sides 4 當shape=polygon時的邊數(shù)
fillcolor lightgrey/black 填充顏色
fixedsize false 標簽是否影響節(jié)點的大小
邊的屬性
[label="Some Label"] # 給邊設(shè)置標簽 (設(shè)置路徑權(quán)重的時候很有用)
[color="red"] # 給交點上色 (標示路徑的時候很有用)
[penwidth=2.0] # 給邊適配厚度汗菜,標示路徑的時候很有用让禀。
arrowhead = normal # 箭頭頭部形狀
arrowsize = 1.0 # 箭頭大小
arrowtail = normal # 箭頭尾部形狀
constraint=true #是否根據(jù)邊來影響節(jié)點的排序
decorate #設(shè)置之后會用一條線來連接edge和label
dir=forward # 設(shè)置方向:forward,back,both,none
headclip=true # 是否到邊界為止
tailclip=true #與headclip類似
文/wsztrush(簡書作者)
原文鏈接:http://www.reibang.com/p/5b02445eca1d
著作權(quán)歸作者所有,轉(zhuǎn)載請聯(lián)系作者獲得授權(quán)陨界,并標注“簡書作者”巡揍。
尺寸, 背景顏色
fixedsize=true;
size="1,1";
resolution=72;
bgcolor="#C6CFD532";
eg
digraph structs {
node[shape=record]
struct1 [label="<f0> left|<f1> mid\ dle|<f2> right"];
struct2 [label="{<f0> one|<f1> two\n\n\n}" shape=Mrecord];
struct3 [label="hello\nworld |{ b |{c|<here> d|e}| f}| g | h"];
struct1:f1 -> struct2:f0;
struct1:f0 -> struct3:f1;
}
dot 語言 三種對象:圖表、結(jié)點普碎、邊緣
digraph 可控制的
graph 不可控制
subgraph 子圖表
繪制屬性:
形狀:多邊形和紀錄
box盒子 ,
polygon多邊形 ,
ellipse橢圓,
oval橢圓,
circle圓,
point ,
egg卵形,
triangle三角 ,
plaintext ,
diamond菱形 ,
trapezium梯形 ,
parallelogram平行四邊形 ,
house ,
pentagon五角形 ,
hexagon六角形 ,
septagon ,
octagon八邊形 ,
doublecircle ,
doubleoctagon ,
tripleoctagon