Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

graphviz output svg

I use graphviz to get the svg back

dot -Tsvg graph.dot -o file
  1. How to set the Graphviz output svg to "rect" node not "polygon"
  2. and the translate is set to (0,0) not (4 256)

thanks a lot

<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>
like image 681
brian Avatar asked Jan 19 '10 04:01

brian


1 Answers

  1. There is no support of in graphviz as of version 2.2.1

graphviz-2.2.1 - dotneato/common/svggen.c

file graphviz-2.2.1.tar.gz›graphviz-2.2.1›dotneato›common›svggen.c or http://graphviz.sourcearchive.com/documentation/2.2.1/svggen_8c-source.html

try to search "<polygon" and '<rect'. Zero for second.

like image 126
osgx Avatar answered Nov 15 '22 04:11

osgx