GraphViz DOT有向图 (一)元素说明

612 阅读2分钟

目录

GraphViz图基本元素说明

E, N, G, S 和 C 相当于 edges, nodes, the root graph, subgraphs 和 cluster subgraphs

  • Graph属性: 定义图的大小,样式,元素的排列方向,超链接等
  • Node 节点: 定义节点的大小,样式,形状,节点说明等
  • Edge 线条: 定义线条样式(虚实箭头等),线条说明等
  • Subgraph 子图: 在graph中嵌套graph
  • Cluster subtraphs 子图集群

node常用属性

属性名默认值说明
colorblacknode图形颜色,see color values
fontcolorblack字体颜色
fontnameTimes-Roman字体
fontsize14字体大小
imagenode背景图片地址
labelnodename node 显示内容
shapeellipse形状
style图形样式,eg、bold、dotted、filled
height.5最低高度尺寸
width.75最低宽度尺寸
URL点击跳转地址
target点击跳转打开方式

edge常用属性

属性名默认值说明
arrowheadnormal箭头样式
arrowsize1.0 箭头尺寸
colorblack颜色
dirforward箭头方向
edgeURL点击跳转地址
fontcolorblack字体颜色
fontnameTimes-Roman 字体
fontsize14字体大小
headport线条头部连接处,eg .n、ne、e、se、s、sw、w、nw
label描述内容
labelfontcolorblacklabel字体颜色
labelfontnameTimes-Roman label字体
labelfontsize14label字体大小
style图形样式,eg .bold、dotted、filled
tailport线条尾部连接处,eg .n、ne、e、se、s、sw、w、nw
weight1integer cost of stretching an edge

graph全局属性

属性名默认值说明
colorblackfor clusters,outline color,and fill color
dpi96图像输出像素
fillcolorblackcluster fill color
fontcolorblack字体颜色
fontnameTimes-Roman字体
fontsize14字体大小
label描述内容
landscapetrue:orientation=landscape
rank子图等级限制, same,min,max,source,sink
rankdirTB图片排列方式,LR(left to right) or TB(top to bottom) or RL(right to left) or BT(bottom to top)
size最大图片尺寸
style图片样式
stylesheet} pathname or URL to XML style sheet for SVG
URL点击跳转地址
target点击跳转打开方式
bgcolor背景颜色