2010-01-19 40 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