graphviz和dot绘制流程图
step1:下载graphviz,https://graphviz.org/download/
step2:安装,记得添加环境变量
step3:验证是否安装成功 dot --version
bash
C:\Users\wangrusheng>dot --version
dot - graphviz version 12.2.1 (20241206.2353)
step4:开始写流程图代码,保存在本地
C:\Users\wangrusheng\Downloads\flow.dot
bash
digraph {
rankdir="LR";
graph [fontname="helvetica", fontsize=12];
node [fontname="helvetica", fontsize=10];
edge [fontname="helvetica", fontsize=10];
start [shape="plaintext", style="rounded", label="I want to extract\nmembers from a zip file."];
fewlarge [shape="box", label="Do you have a few\nlarge files zip files\nwith tens\nof thousands\nof members?"];
manysmall [shape="box", label="Do you have\nmany small files\nwith a few\ndozen members?"];
extractsome [shape="box", label="Do you need\nto extract many\nmembers but\nnot all?"];
end [shape="plaintext", style="rounded", label="Use vanilla unzip."];
unzippa [shape="plaintext", style="rounded", label="Maybe unzippa is faster."];
{
rank=same; start; fewlarge; manysmall; end;
}
{
rank=same; extractsome; unzippa;
}
start -> fewlarge;
fewlarge -> manysmall[label="No"];
fewlarge -> extractsome[label="Yes"];
manysmall -> end[label="No"];
manysmall -> extractsome[label="Yes"];
extractsome -> end[label="No"];
extractsome -> unzippa[label="Yes"];
}
step5:用命令行,生成图片
bash
Microsoft Windows [版本 10.0.26100.3915]
(c) Microsoft Corporation。保留所有权利。
C:\Users\wangrusheng>dot --version
dot - graphviz version 12.2.1 (20241206.2353)
C:\Users\wangrusheng>dot -Tpng "C:\Users\wangrusheng\Downloads\flow.dot" -o "C:\Users\wangrusheng\Downloads\flow.png"
C:\Users\wangrusheng>
step6:去对应目录打开图片,就能看到效果
end