2010-01-19 109 views
2

我使用的graphviz得到SVG回graphviz的输出SVG

dot -Tsvg graph.dot -o file 
  1. 如何设定的Graphviz输出SVG为“矩形”节点而不是“多边形”
  2. 和翻译设置为(0 ,0)不(4 256)

非常感谢

<g id="graph1" class="graph" transform="scale(1 1) rotate(0) translate(4 256)"> 
<polygon fill="white" stroke="white" points="-4,5 -4,-256 265,-256 265,5 -4,5"/> 

digraph G { 
     a1 [id=a1 shape=rectangle]; 
     a2 [id=a2 shape=rectangle]; 
     a3 [id=a3 shape=rectangle]; 
     a4 [id=a4 shape=rectangle]; 
     a5 [id=a5 shape=rectangle]; 
     a1 -> a5; 
     a2 -> a1; 
     a2 -> a5; 
     a3 -> a2; 
     a4 -> a2; 
     a4 -> a4; 
} 


<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> 
<!-- Generated by graphviz version 2.26.0 (20091210.2329) 
--> 
<!-- Title: G Pages: 1 --> 
<svg width="152pt" height="260pt" 
viewBox="0.00 0.00 152.00 260.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 
<g id="graph1" class="graph" transform="scale(1 1) rotate(0) translate(4 256)"> 
<title>G</title> 
<polygon fill="white" stroke="white" points="-4,5 -4,-256 149,-256 149,5 -4,5"/> 
<!-- a1 --> 
<g id="a1" class="node"><title>a1</title> 
<polygon fill="none" stroke="black" points="63,-108 9,-108 9,-72 63,-72 63,-108"/> 
<text text-anchor="middle" x="36" y="-86.4" font-family="Times Roman,serif" font-size="14.00">a1</text> 
</g> 
<!-- a5 --> 
<g id="a5" class="node"><title>a5</title> 
<polygon fill="none" stroke="black" points="90,-36 36,-36 36,-1.77636e-14 90,-3.55271e-15 90,-36"/> 
<text text-anchor="middle" x="63" y="-14.4" font-family="Times Roman,serif" font-size="14.00">a5</text> 
</g> 
<!-- a1&#45;&gt;a5 --> 
<g id="edge2" class="edge"><title>a1&#45;&gt;a5</title> 
<path fill="none" stroke="black" d="M42.8132,-71.8314C45.7644,-63.9617 49.2858,-54.5712 52.555,-45.8533"/> 
<polygon fill="black" stroke="black" points="55.8609,-47.0055 56.095,-36.4133 49.3066,-44.5476 55.8609,-47.0055"/> 
</g> 
<!-- a2 --> 
<g id="a2" class="node"><title>a2</title> 
<polygon fill="none" stroke="black" points="90,-180 36,-180 36,-144 90,-144 90,-180"/> 
<text text-anchor="middle" x="63" y="-158.4" font-family="Times Roman,serif" font-size="14.00">a2</text> 
</g> 
<!-- a2&#45;&gt;a1 --> 
<g id="edge4" class="edge"><title>a2&#45;&gt;a1</title> 
<path fill="none" stroke="black" d="M56.1868,-143.831C53.2356,-135.962 49.7142,-126.571 46.445,-117.853"/> 
<polygon fill="black" stroke="black" points="49.6934,-116.548 42.905,-108.413 43.1391,-119.006 49.6934,-116.548"/> 
</g> 
<!-- a2&#45;&gt;a5 --> 
<g id="edge6" class="edge"><title>a2&#45;&gt;a5</title> 
<path fill="none" stroke="black" d="M66.8413,-143.6C68.8166,-133.203 71.0123,-119.935 72,-108 73.3197,-92.0545 73.3197,-87.9455 72,-72 71.3055,-63.6085 70.0138,-54.5578 68.6214,-46.3092"/> 
<polygon fill="black" stroke="black" points="72.0544,-45.6235 66.8413,-36.3999 65.1647,-46.8612 72.0544,-45.6235"/> 
</g> 
<!-- a3 --> 
<g id="a3" class="node"><title>a3</title> 
<polygon fill="none" stroke="black" points="54,-252 2.4869e-14,-252 0,-216 54,-216 54,-252"/> 
<text text-anchor="middle" x="27" y="-230.4" font-family="Times Roman,serif" font-size="14.00">a3</text> 
</g> 
<!-- a3&#45;&gt;a2 --> 
<g id="edge8" class="edge"><title>a3&#45;&gt;a2</title> 
<path fill="none" stroke="black" d="M36.0843,-215.831C40.0615,-207.877 44.8155,-198.369 49.2139,-189.572"/> 
<polygon fill="black" stroke="black" points="52.4517,-190.923 53.7934,-180.413 46.1907,-187.792 52.4517,-190.923"/> 
</g> 
<!-- a4 --> 
<g id="a4" class="node"><title>a4</title> 
<polygon fill="none" stroke="black" points="126,-252 72,-252 72,-216 126,-216 126,-252"/> 
<text text-anchor="middle" x="99" y="-230.4" font-family="Times Roman,serif" font-size="14.00">a4</text> 
</g> 
<!-- a4&#45;&gt;a2 --> 
<g id="edge10" class="edge"><title>a4&#45;&gt;a2</title> 
<path fill="none" stroke="black" d="M89.9157,-215.831C85.9385,-207.877 81.1845,-198.369 76.7861,-189.572"/> 
<polygon fill="black" stroke="black" points="79.8093,-187.792 72.2066,-180.413 73.5483,-190.923 79.8093,-187.792"/> 
</g> 
<!-- a4&#45;&gt;a4 --> 
<g id="edge12" class="edge"><title>a4&#45;&gt;a4</title> 
<path fill="none" stroke="black" d="M126.241,-247.487C136.024,-247.777 144,-243.281 144,-234 144,-228.199 140.884,-224.268 136.159,-222.206"/> 
<polygon fill="black" stroke="black" points="136.687,-218.745 126.241,-220.513 135.509,-225.646 136.687,-218.745"/> 
</g> 
</g> 
</svg> 
+0

请向我们展示(至少是您的输入文件的示例)。 – 2010-01-19 04:37:12

+0

你有什么想法吗? – brian 2010-01-20 02:30:37

回答

2
  1. 有一个在graphviz的不支持的为2.2.1版本

的graphviz-2.2.1 - dotneato /普通/ svggen.c

文件的graphviz-2.2.1.tar.gz> graphviz的-2.2.1>dotneato›common›svggen.chttp://graphviz.sourcearchive.com/documentation/2.2.1/svggen_8c-source.html

尝试搜索 “<多边形” 与 '<矩形'。零秒。

+0

另外,请检查svggen.c是否为您的版本。 如果多边形和translate = xx是硬编码的,您可以更改它们。 否则 - 尝试搜索代码路径,这将打开rect并更改翻译。 – osgx 2010-02-03 22:39:48

+0

链接已损坏 – nponeccop 2017-12-23 00:03:16