Commit 0dc3efde authored by Mark Hansen's avatar Mark Hansen
Browse files

Add examples for plaintext formats.

And add some more explanation for some other formats.
parent 39e99de6
......@@ -14,7 +14,7 @@ These formats produce output in the
Using `canon` produces a prettyprinted version of the input,
with no layout performed.
The `dot` option corresponds to attributed dot output,
The `dot` (and `gv` alias) options correspond to attributed dot output,
and is the default output format.
It reproduces the input, along with layout information for the graph.
In particular, a [`bb`](attrs.html#d:bb) attribute is
......@@ -197,3 +197,62 @@ Version info:
| >1.5 | 2.34 | Fix text layout problem; fix inverted vector in gradient; support version-specific output; new **t** op for text characteristics
| >1.6 | 2.35 | Add STRIKE-THROUGH bit for`t`
| >1.7 | 2.37 | Add OVERLINE for `t`
{{< card header="Example: simple graph, canonicalized formatting with `-Tcanon`">}}
```
$ echo 'digraph { a->b }' | dot -Tcanon
```
```dot
digraph {
node [label="\N"];
a -> b;
}
```
{{</ card >}}
{{< card header="Example: simple graph, outputting layout positioning with `-Tdot`">}}
```
$ echo 'digraph { a->b }' | dot -Tdot
```
```dot
digraph {
graph [bb="0,0,54,108"];
node [label="\N"];
a [height=0.5,
pos="27,90",
width=0.75];
b [height=0.5,
pos="27,18",
width=0.75];
a -> b [pos="e,27,36.104 27,71.697 27,63.983 27,54.712 27,46.112"];
}
```
{{</ card >}}
{{< card header="Example: simple graph, outputting layout positioning & drawing information with `-Txdot`">}}
```
$ echo 'digraph { a->b }' | dot -Txdot
```
```dot
digraph {
graph [_draw_="c 9 -#fffffe00 C 7 -#ffffff P 4 0 0 0 108 54 108 54 0 ",
bb="0,0,54,108",
xdotversion=1.7
];
node [label="\N"];
a [_draw_="c 7 -#000000 e 27 90 27 18 ",
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 27 86.3 0 7 1 -a ",
height=0.5,
pos="27,90",
width=0.75];
b [_draw_="c 7 -#000000 e 27 18 27 18 ",
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 27 14.3 0 7 1 -b ",
height=0.5,
pos="27,18",
width=0.75];
a -> b [_draw_="c 7 -#000000 B 4 27 71.7 27 63.98 27 54.71 27 46.11 ",
_hdraw_="S 5 -solid c 7 -#000000 C 7 -#000000 P 3 30.5 46.1 27 36.1 23.5 46.1 ",
pos="e,27,36.104 27,71.697 27,63.983 27,54.712 27,46.112"];
}
{{</ card >}}
......@@ -5,3 +5,41 @@ params:
- fig
---
Outputs graphs in the [FIG graphics language](https://en.wikipedia.org/wiki/Xfig).
{{< card header="Example outputs of a simple graph with two nodes connected with an edge:">}}
```
$ echo 'digraph { a->b }' | dot -Tfig
```
```
#FIG 3.2
# Generated by graphviz version 2.47.1 (20210417.1919)
# Title: %3
# Pages: 1
Portrait
Center
Inches
Letter
100.00
Single
-2
1200 2
0 32 #d3d3d3
0 33 #fffffe
2 3 0 1 33 7 2 0 20 0.0 0 0 0 0 0 5
0 2320 0 0 1240 0 1240 2320 0 2320
# a
1 1 0 1 0 7 1 0 -1 0.000 0 0.0000 620 440 540 -360 620 440 1160 80
4 1 0 1 0 0 14.0 0.0000 6 14.0 4.7 620 498 a\001
# b
1 1 0 1 0 7 1 0 -1 0.000 0 0.0000 620 1880 540 -360 620 1880 1160 1520
4 1 0 1 0 0 14.0 0.0000 6 14.0 4.7 620 1938 b\001
# a->b
3 4 0 1 0 0 0 0 -1 0.0 0 0 0 7
620 806 620 886 620 969 620 1055 620 1143 620 1231 620 1318
0 1 1 1 1 1 0
2 3 0 1 0 0 0 0 20 0.0 0 0 0 0 0 4
690 1318 620 1518 550 1318 690 1318
# end of FIG file
```
{{</ card >}}
......@@ -4,3 +4,7 @@ params:
- jp2
---
Output using the [JPEG 2000](http://www.jpeg.org/jpeg2000/) format.
JPEG's image compression can blur fine image details like text & lines, so
consider using a lossless format (say, [PNG](/docs/outputs/png/) or
[WebP](/docs/outputs/webp/)) instead.
......@@ -7,3 +7,7 @@ params:
- jpe
---
Output JPEG compressed image files.
JPEG's image compression can blur fine image details like text & lines, so
consider using a lossless format (say, [PNG](/docs/outputs/png/) or
[WebP](/docs/outputs/webp/)) instead.
......@@ -27,6 +27,269 @@ the subgraph or node in the `objects` array. This also holds
true for the edges in the `objects` array. Note that this format
allows clustered graphs, where edges can connect clusters as well as nodes.
{{< card header="Example: simple graph rendered with `-Tdot_json`">}}
```
$ echo 'digraph { a->b }' | dot -Tdot_json
```
```json
{
"name": "%3",
"directed": true,
"strict": false,
"_subgraph_cnt": 0,
"objects": [
{
"_gvid": 0,
"name": "a",
"label": "\\N"
},
{
"_gvid": 1,
"name": "b",
"label": "\\N"
}
],
"edges": [
{
"_gvid": 0,
"tail": 0,
"head": 1
}
]
}
```
{{< /card >}}
{{< card header="Example: simple graph rendered with `-Txdot_json`">}}
```
$ echo 'digraph { a->b }' | dot -Txdot_json
```
```dot
{
"name": "%3",
"directed": true,
"strict": false,
"_subgraph_cnt": 0,
"objects": [
{
"_gvid": 0,
"name": "a",
"label": "\\N"
},
{
"_gvid": 1,
"name": "b",
"label": "\\N"
}
],
"edges": [
{
"_gvid": 0,
"tail": 0,
"head": 1
}
]
}
```
{{< /card >}}
{{< card header="Example: simple graph rendered with `-Tjson0`">}}
```
$ echo 'digraph { a->b }' | dot -Tjson0
```
```dot
{
"name": "%3",
"directed": true,
"strict": false,
"bb": "0,0,54,108",
"_subgraph_cnt": 0,
"objects": [
{
"_gvid": 0,
"name": "a",
"height": "0.5",
"label": "\\N",
"pos": "27,90",
"width": "0.75"
},
{
"_gvid": 1,
"name": "b",
"height": "0.5",
"label": "\\N",
"pos": "27,18",
"width": "0.75"
}
],
"edges": [
{
"_gvid": 0,
"tail": 0,
"head": 1,
"pos": "e,27,36.104 27,71.697 27,63.983 27,54.712 27,46.112"
}
]
}
```
{{< /card >}}
{{< card header="Example: simple graph rendered with `-Tjson`">}}
```
echo 'digraph { a->b }' | dot -Tjson
```
```json
{
"name": "%3",
"directed": true,
"strict": false,
"_draw_":
[
{
"op": "c",
"grad": "none",
"color": "#fffffe00"
},
{
"op": "C",
"grad": "none",
"color": "#ffffff"
},
{
"op": "P",
"points": [[0.000,0.000],[0.000,108.000],[54.000,108.000],[54.000,0.000]]
}
],
"bb": "0,0,54,108",
"xdotversion": "1.7",
"_subgraph_cnt": 0,
"objects": [
{
"_gvid": 0,
"name": "a",
"_draw_":
[
{
"op": "c",
"grad": "none",
"color": "#000000"
},
{
"op": "e",
"rect": [27.000,90.000,27.000,18.000]
}
],
"_ldraw_":
[
{
"op": "F",
"size": 14.000,
"face": "Times-Roman"
},
{
"op": "c",
"grad": "none",
"color": "#000000"
},
{
"op": "T",
"pt": [27.000,86.300],
"align": "c",
"width": 7.000,
"text": "a"
}
],
"height": "0.5",
"label": "\\N",
"pos": "27,90",
"width": "0.75"
},
{
"_gvid": 1,
"name": "b",
"_draw_":
[
{
"op": "c",
"grad": "none",
"color": "#000000"
},
{
"op": "e",
"rect": [27.000,18.000,27.000,18.000]
}
],
"_ldraw_":
[
{
"op": "F",
"size": 14.000,
"face": "Times-Roman"
},
{
"op": "c",
"grad": "none",
"color": "#000000"
},
{
"op": "T",
"pt": [27.000,14.300],
"align": "c",
"width": 7.000,
"text": "b"
}
],
"height": "0.5",
"label": "\\N",
"pos": "27,18",
"width": "0.75"
}
],
"edges": [
{
"_gvid": 0,
"tail": 0,
"head": 1,
"_draw_":
[
{
"op": "c",
"grad": "none",
"color": "#000000"
},
{
"op": "b",
"points": [[27.000,71.700],[27.000,63.980],[27.000,54.710],[27.000,46.110]]
}
],
"_hdraw_":
[
{
"op": "S",
"style": "solid"
},
{
"op": "c",
"grad": "none",
"color": "#000000"
},
{
"op": "C",
"grad": "none",
"color": "#000000"
},
{
"op": "P",
"points": [[30.500,46.100],[27.000,36.100],[23.500,46.100]]
}
],
"pos": "e,27,36.104 27,71.697 27,63.983 27,54.712 27,46.112"
}
]
}
```
<style>
.jsontable {
border: 1px solid black;
......@@ -35,4 +298,3 @@ allows clustered graphs, where edges can connect clusters as well as nodes.
</style>
{{< schema >}}
......@@ -6,3 +6,81 @@ params:
---
Output is given in the text-based PIC language developed for troff.
See [PIC language](https://en.wikipedia.org/wiki/Pic_language).
{{< card header="Example outputs of a simple graph with two nodes connected with an edge:">}}
```
$ echo 'digraph { a->b }' | dot -Tpic
```
```
# Creator: graphviz version 2.47.1 (20210417.1919)
# Title: %3
# save point size and font
.nr .S \n(.s
.nr DF \n(.f
.PS 0.86111 1.61111
# to change drawing size, multiply the width and height on the .PS line above and the number on the two lines below (rounded to the nearest integer) by a scale factor
.nr SF 861
scalethickness = 861
# don't change anything below this line in this drawing
# non-fatal run-time pic version determination, version 2
boxrad=2.0 # will be reset to 0.0 by gpic only
scale=1.0 # required for comparisons
# boxrad is now 0.0 in gpic, else it remains 2.0
# dashwid is 0.1 in 10th Edition, 0.05 in DWB 2 and in gpic
# fillval is 0.3 in 10th Edition (fill 0 means black), 0.5 in gpic (fill 0 means white), undefined in DWB 2
# fill has no meaning in DWB 2, gpic can use fill or filled, 10th Edition uses fill only
# DWB 2 doesn't use fill and doesn't define fillval
# reset works in gpic and 10th edition, but isn't defined in DWB 2
# DWB 2 compatibility definitions
if boxrad > 1.0 && dashwid < 0.075 then X
fillval = 1;
define fill Y Y;
define solid Y Y;
define reset Y scale=1.0 Y;
X
reset # set to known state
# GNU pic vs. 10th Edition d\(e'tente
if fillval > 0.4 then X
define setfillval Y fillval = 1 - Y;
define bold Y thickness 2 Y;
# if you use gpic and it barfs on encountering "solid",
# install a more recent version of gpic or switch to DWB or 10th Edition pic;
# sorry, the groff folks changed gpic; send any complaint to them;
X else Z
define setfillval Y fillval = Y;
define bold Y Y;
define filled Y fill Y;
Z
# arrowhead has no meaning in DWB 2, arrowhead = 7 makes filled arrowheads in gpic and in 10th Edition
# arrowhead is undefined in DWB 2, initially 1 in gpic, 2 in 10th Edition
arrowhead = 7 # not used by graphviz
# GNU pic supports a boxrad variable to draw boxes with rounded corners; DWB and 10th Ed. do not
boxrad = 0 # no rounded corners in graphviz
# GNU pic supports a linethick variable to set line thickness; DWB and 10th Ed. do not
linethick = 0; oldlinethick = linethick
# .PS w/o args causes GNU pic to scale drawing to fit 8.5x11 paper; DWB does not
# maxpsht and maxpswid have no meaning in DWB 2.0, set page boundaries in gpic and in 10th Edition
# maxpsht and maxpswid are predefined to 11.0 and 8.5 in gpic
maxpsht = 1.611111
maxpswid = 0.861111
Dot: [
define attrs0 % %; define unfilled % %; define rounded % %; define diagonals % %
move to (0, 0); line to (0, 116); line to (62, 116); line to (62, 0); line to (0, 0)
# a
ellipse attrs0 wid 0.75000 ht 0.50000 at (0.43056,1.30556);
.ft R
.ps 14*\n(SFu/861u
"a" at (27.54861,87.56481);
# b
ellipse attrs0 wid 0.75000 ht 0.50000 at (0.43056,0.30556);
"b" at (27.54861,15.56481);
# a->b
move to (31, 76); spline to (31, 72); spline to (31, 68); spline to (31, 63); spline to (31, 59); spline to (31, 54); spline to (31, 50)
move to (35, 50); line to (31, 40); line to (28, 50); line to (35, 50)
]
.PE
# restore point size and font
.ps \n(.S
.ft \n(DF
```
{{</ card >}}
......@@ -10,6 +10,34 @@ a simple, line-based language.
The latter format differs in that, on edges, it provides port names
on head and tail nodes when applicable.
Example outputs of a simple graph with two nodes connected with an edge:
{{< card header="`-Tplain`">}}
```
$ echo 'digraph { a->b }' | dot -Tplain
```
```
graph 1 0.75 1.5
node a 0.375 1.25 0.75 0.5 a solid ellipse black lightgrey
node b 0.375 0.25 0.75 0.5 b solid ellipse black lightgrey
edge a b 4 0.375 0.99579 0.375 0.88865 0.375 0.7599 0.375 0.64045 solid black
stop
```
{{</ card >}}
{{< card header="`-Tplain-ext`">}}
```
$ echo 'digraph { a->b }' | dot -Tplain-ext
```
```
graph 1 0.75 1.5
node a 0.375 1.25 0.75 0.5 a solid ellipse black lightgrey
node b 0.375 0.25 0.75 0.5 b solid ellipse black lightgrey
edge a b 4 0.375 0.99579 0.375 0.88865 0.375 0.7599 0.375 0.64045 solid black
stop
```
{{</ card >}}
There are four types of statements.
<PRE>
<STRONG>graph</STRONG> <I>scale</I> <I>width</I> <I>height</I>
......
......@@ -6,3 +6,146 @@ params:
---
Scene-description language for 3D modelling for the
[Persistence of Vision Raytracer](http://www.povray.org/).
{{< card header="Example: simple graph, rendered with `-Tpov`">}}
```
$ echo 'digraph { a->b }' | dot -Tpov
```
```
#version 3.6;
global_settings { assumed_gamma 1.0 }
#default { finish { ambient 0.1 diffuse 0.9 } }
#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"
#declare black = Black;
#declare white = White;
//*** begin_graph %3
camera { location <31.000 , 58.000 , -500.000>
look_at <31.000 , 58.000 , 0.000>
right x * image_width / image_height
angle 15.880
}
//sky
plane { <0, 1, 0>, 1 hollow
texture {
pigment { bozo turbulence 0.95
color_map {
[0.00 rgb <0.05, 0.20, 0.50>]
[0.50 rgb <0.05, 0.20, 0.50>]
[0.75 rgb <1.00, 1.00, 1.00>]
[0.75 rgb <0.25, 0.25, 0.25>]
[1.00 rgb <0.50, 0.50, 0.50>]
}
scale <1.00, 1.00, 1.50> * 2.50
translate <0.00, 0.00, 0.00>
}
finish { ambient 1 diffuse 0 }
}
scale 10000
}
//mist
fog { fog_type 2
distance 50
color rgb <1.00, 1.00, 1.00> * 0.75
fog_offset 0.10
fog_alt 1.50
turbulence 1.75
}
//gnd
plane { <0.00, 1.00, 0.00>, 0
texture {
pigment{ color rgb <0.25, 0.45, 0.00> }
normal { bumps 0.75 scale 0.01 }
finish { phong 0.10 }
}
}
light_source { <1500,3000,-2500> color White }
//*** begin_page
//*** comment: a
//*** begin_node: a
//*** ellipse
torus { 1.000, 0.056
scale < 27.000, 11.250, 18.000>
rotate < 90.000, 0.000, 0.000>
translate< 31.000, 94.000, -6.000>
pigment { color black transmit 0.000 }
}
//*** textspan: a, fontsize = 14.000, fontname = Times-Roman
text {
ttf "Times-Roman",
"a", 0.250, 0.000
no_shadow
scale 14.000
rotate < 0.000, 0.000, 0.000>
translate< 27.500, 87.500, -9.000>
pigment { color black transmit 0.000 }
}
//*** end_node
//*** comment: b
//*** begin_node: b
//*** ellipse
torus { 1.000, 0.056
scale < 27.000, 11.250, 18.000>
rotate < 90.000, 0.000, 0.000>
translate< 31.000, 22.000, -6.000>
pigment { color black transmit 0.000 }
}
//*** textspan: b, fontsize = 14.000, fontname = Times-Roman
text {
ttf "Times-Roman",
"b", 0.250, 0.000
no_shadow
scale 14.000
rotate < 0.000, 0.000, 0.000>
translate< 27.500, 15.500, -9.000>