Difference between revisions of "SVG using Graphviz"

From PostgreSQL wiki
Jump to: navigation, search
m (typo)
m (An example)
 
Line 9: Line 9:
  
 
The syntax of source files is ''DOT'' (https://en.wikipedia.org/wiki/DOT_(graph_description_language) ), the default file extention is .gv.
 
The syntax of source files is ''DOT'' (https://en.wikipedia.org/wiki/DOT_(graph_description_language) ), the default file extention is .gv.
 +
 +
== Example  ==
 +
The typical header of our files looks like this:
 +
 +
<pre>
 +
digraph {
 +
 +
layout=dot;
 +
 +
// default values
 +
node  [shape=box, label="", fontname="sans-serif", style=filled, fillcolor=white, width=2.2, fontsize=8];
 +
graph [fontname="sans-serif"]; // must be specified separately
 +
edge  [fontname="sans-serif"]; // must be specified separately
 +
 +
// an unobtrusive background color
 +
pad="1.0, 0.5";
 +
bgcolor=whitesmoke;
 +
 +
// layout of edges and nodes
 +
splines=ortho;
 +
nodesep=0.3;
 +
ranksep=0.3;
 +
 +
label="An example graph" fontsize=26;
 +
...
 +
...
 +
</pre>
 +
  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SVG]]
 
[[Category:SVG]]

Latest revision as of 19:39, 19 July 2019

Graphviz

Graphviz (https://graphviz.org/) is a package of tools which visualize directed and undirected graphs with different strategies:

  • dot - default for directed graphs
  • neato - "spring model" layouts
  • fdp - similar to neato
  • sfdp - multiscale version of fdp for the layout of large graphs
  • twopi - radial layouts
  • circo - circular layout

The syntax of source files is DOT (https://en.wikipedia.org/wiki/DOT_(graph_description_language) ), the default file extention is .gv.

Example

The typical header of our files looks like this:

digraph {

	layout=dot;

	// default values
	node  [shape=box, label="", fontname="sans-serif", style=filled, fillcolor=white, width=2.2, fontsize=8];
	graph [fontname="sans-serif"]; // must be specified separately
	edge  [fontname="sans-serif"]; // must be specified separately

	// an unobtrusive background color
	pad="1.0, 0.5";
	bgcolor=whitesmoke;

	// layout of edges and nodes
	splines=ortho;
	nodesep=0.3;
	ranksep=0.3;

	label="An example graph" fontsize=26;
	...
	...