您的位置:首页 > 其它

Dot 与 GraphViz 经验总结

2016-08-16 22:30 363 查看

reference

d3.js gallery: 仅仅是作个比较,d3的图确实好看一点

dot graphviz gallery: 其实也还不错

graphviz documence: 不同于官方文档, github 上的文档更新会快一点,当然个人觉得也好一点。

dot pdf documence: 简洁的pdf文档,省去了多余的东东。

dot html documence: 很好的example

dot 国人教程

高级API for style,type and other attributes

color gallery

ubuntu

注:本人仅在ubuntu上进行了测试

安装

sudo apt-get install graphviz

在ubuntu16.04上就这样安装好了,从源码上安装失败,少了scan.c,反正能用,所以不管了。

使用

dot -Tjpg example.dot -oexample.jpg

example.dot

graph graphname{
a--b;
b--c;
b--d;
d--a;
}


指明输出格式为jpg, -Tjpg, 所有输出格式

指明输出文件名为example.jpg -oexample.jpg

example.jpg



An Ugly Tool and A nice Plugin

DotEditor: 编辑功能极弱,用法是用别的编辑器进行dot文件编辑,再复制到DotEditor中进行显示。

[gedit plugin external tool]:自定义功能极强,可结合gedit 的编辑能力,非常好用。在下面的脚本和图示配置下,按
F5
即可显示dot图像。

#!/bin/sh
format=jpg
fin=${GEDIT_CURRENT_DOCUMENT_NAME}
fout=${GEDIT_CURRENT_DOCUMENT_NAME}.${format}
touch ${fout}
echo ${fin}
echo ${fout}
dot -T${format} $fin -o${fout} & gnome-open ${fout}


更多gedit变量及external tool的用法可以参考官网

更多的gedit external tool 插件脚本



High Level Summary

for subgraph, the
cluster_i
(i=0,1,2,…) is special

we can use
{...}
to set local environment

set node
node [style=filled,color=lightpink];


set edge
a->b [label='...']


use set
{a,b,c}->c; a->{b,c,d}


set edge direction
edge [dir=both/none/forward/back;penwidth=3]
,
digraph
,
graph


set graph direction
rankdir="TB", "LR", "BT", "RL"


for
dash,solid...
see
style
at 高级API for style,type and other attributes

for color
node [style=filled,color=lightyellow];
see color gallery

digraph G {

subgraph Ncluster_0 {
style=filled;
color=lightgrey;
node [style=filled,color=lightgray];
start -> "motion detection" -> "connected component analysis" -> "small area filter" -> "object feature extraction" -> "object association" -> "association graph" -> "find min tree";
class -> "IBGS.process()" -> "icvprCcaByTwoPass()" -> "QYzbxTrackingFeature.getObjectsFromMask()" -> "QYzbxTrackingFeature.getObjects()" -> "TrackingObjectAssociation.adjecentObjectAssociation()" -> "TrackingObjectAssociation.process()" -> "MotionBasedTracker.objectTracking()";
data -> "image:CV_8UC3" -> "mask:CV_8UC1" -> "vector<mask>" -> "vector<ObjectFeature>" -> "list<FrameFeature>" ->"DirectGraph"->"tracking record";
label="2016/08/20: Connected Component Analysis"
}

subgraph Ncluster_1 {
style=filled
color=blue
node [style=filled,color=lightpink];
"motion detection" -> "contour analysis" -> "kalman filter" -> "hungrian algorithm" -> "trakcking result"
data -> "image:CV_8UC3" -> "mask:CV_8UC1" -> "contour:vector<Point>" -> "vector<trackingObjectFeature>" -> "MultiObjectTracker:vector<singleObjectTracker>"
label="2016/08/22: findContour"
}

subgraph Ncluster_2 {
style=filled
color=red
node [style=filled,color=lightyellow];
"motion detection" -> "blob detection" -> "kalman filter" -> "hungrian algorithm" -> "trakcking result"
data -> "image:CV_8UC3" -> "mask:CV_8UC1" -> "blob feature" -> "vector<trackingObjectFeature>" -> "MultiObjectTracker:vector<singleObjectTracker>"
label="2016/08/23: blob detector"
}

}


digraph G{
{node[style=filled,color=lightyellow]
input
"QString:configFile"
"QString:videoFile"
"TrackingStatus*:status"
}

{node[style=filled,color=lightpink]
function
"void:process()"
"void:processOne()"
"vector<trackingObjectFeature>:getObjects()"
"void:Tracking()"
"void:run()"
"void:stop()"
}

{node[style=filled,color=lightblue]
explain
"show tracking result"
"init singleObjectTracker"
"update singleObjectTracker"
}

{"QString:configFile","QString:videoFile"}->"void:process()"
"void:process()"->{"Mat:img_input","Mat:img_foreground","Mat:img_background"}
"void:process()"->"void:processOne()"->"vector<trackingObjectFeature>:getObjects()"->"vector<trackingObjectFeature>"->"void:Tracking()"
"void:Tracking()"->"init singleObjectTracker"->"update singleObjectTracker"[label="kalman and hungrian"]
"void:processOne()"->"show tracking result"
"void:process()"->"void:run()"

{"Mat:img_input","Mat:img_foreground","Mat:img_background","TrackingStatus*:status"}->"void:processOne()"

{edge [dir=both;penwidth=3]
"TrackingStatus*:status"->"TrackingStatus*:globalTrackingStatus"[label="always equal to"]
{"TrackingStatus*:globalTrackingStatus","bool:globalStop"}->"void:run()"
"void:process()"->"TrackingStatus*:status"
}

"void:stop()"->"bool:globalStop"
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  graphviz