graphviz官网:http://www.graphviz.org/

背景:有画图需要,之前见到别人用graphviz画,画出来的图漂亮,且自动帮你排版安排布局,所以自己想尝试用它画。

其中遇到的几个问题

  1. win系统下载msi安装包后进行安装,安装不成功,报错信息是win电脑却少什么包,最后转向Mac画图。
  2. 找到两个graphviz online的网站(http://www.webgraphviz.com/  和),都不太好用,不是对中文支持不好,就是稍微复杂一些的图他就画不出来了。
  3. Mac 的安装了graphviz,但是你要先保存.dot文件,编码方式选为utf-8,再用Graphviz打开,就可以支持中文。
  4. 对于如何调字体颜色,大小,形状,标签等,参考官网帮助页面都可以搞定。

为什么用这个工具画图?

  1. 自动帮你排版
  2. 如果图要改动,后续维护简单
  3. 画出来的图好看,逼格高

最后放一张自己画的图

画图用的代码:

digraph ER {
//size = "9, 15";//图片大小
//fontsize=22
compound=true;
node [shape=ellipse,fontname=微软雅黑,labelfontsize=9,fontsize=28]; u89; c1;
node [shape=box,style=filled,color=palegreen1]; a45;y78;h8;
node [shape=diamond,style=filled,color=grey92];"b1";"p9";
fontsize=25
a [shape=diamond,style=filled,color=lgrey92,label="a1"];
b [shape=diamond,style=filled,color=grey92,label="a2"]; c [shape=diamond,style=filled,color=grey92,label="a3"];
d [shape=diamond,style=filled,color=grey92,label="a4"];
u89 -> a45;
a45 -> "b1"[label="",len=1.00]; "b1" -> a [label="是",len=1.00,fontname=微软雅黑,fontsize=25];
"b1" -> b [label="否",len=1.00,fontname=微软雅黑,fontsize=25];
subgraph cluster_0 {
style=filled;
color=bisque;
label = "b2";
fontname=微软雅黑
node [shape=diamond,style=filled,color=grey92];"p9";
a [shape=diamond,style=filled,color=grey92,label="d7"];
c [shape=diamond,style=filled,color=grey92,label="f17"];
m [shape=box,label=y78,style=filled,color=palegreen1];
a -> m [label="是",len=1.00,fontname=微软雅黑,fontsize=25];
a -> "p9" [label="否",len=1.00,fontname=微软雅黑,fontsize=25];
"p9" -> c [label="是",len=1.00,fontname=微软雅黑,fontsize=25];
"p9" -> m [label="否",len=1.00,fontname=微软雅黑,fontsize=25];
c -> m [label="是",len=1.00,fontname=微软雅黑,fontsize=25];
c -> h8 [label="否",len=1.00,fontname=微软雅黑,fontsize=25];
}
subgraph cluster_1 {
//graph[rank=min;width=11;height=26];
label = "aa";
fontname=微软雅黑;
style = filled;
color=lightblue;
b [shape=diamond,style=filled,color=grey92,label="d7"];
d [shape=diamond,style=filled,color=grey92,label="f17"];
n [shape=box,label=y78,style=filled,color=palegreen1];
b -> n [label="是",len=1.00,fontname=微软雅黑,fontsize=25];
b -> d [label="否",len=1.00,fontname=微软雅黑,fontsize=25];
d -> n [label="是",len=1.00,fontname=微软雅黑,fontsize=25];
d -> y78 [label="否",len=1.00,fontname=微软雅黑,fontsize=25];
}
m -> c1;
n -> c1;
y78 -> c1;
h8 -> c1;
}

总结:多动手,多积累实战经验。博客园也有其他说这个工具的文章,

利用Graphviz 画结构图

Graphviz-Gdot语言学习

等。

最新文章

  1. 项目游戏开发日记 No.0x000006(Finish)
  2. linux网卡混杂模式
  3. Nopcommerce 二次开发2 Admin
  4. 怎样实现了捕获应用中的日志在android开发中
  5. android文件存储位置切换
  6. 团购、定时抢购倒计时js版
  7. 11g_job执行带参数的procedure
  8. Python 获得命令行参数的方法
  9. VisualBox会造成VPN连接不上问题
  10. JAVA IO之管道流总结大全(转)
  11. #include <mutex>
  12. spring security执行流程图
  13. linux内核代码container_of
  14. 在html页面中展示JSON
  15. iOS和Android开发异同点(一)
  16. Python距离放弃又近了Day02
  17. python开发流程及项目目录规范
  18. Jackson 解析json数据之忽略解析字段注解@JsonIgnoreProperties
  19. MSA微服务
  20. Linux - DNF包管理

热门文章

  1. python 爬虫系列02-小说
  2. Beam编程系列之Apache Beam WordCount Examples(MinimalWordCount example、WordCount example、Debugging WordCount example、WindowedWordCount example)(官网的推荐步骤)
  3. Linux 下安装 Memcached 和 PHP 开启 Memcached 扩展 及 LAMP 环境的安装
  4. Python Fabric ssh 配置解读
  5. JavaScript基础(String)
  6. C# 使用cookie实现登录
  7. mysql通过数据文件恢复数据方法
  8. js之正则表达式基础
  9. canvas-菜鸟版画布时钟
  10. Android性能优化之渲染篇