Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Output Formats Daniel@0: Daniel@0: Daniel@0: Daniel@0:

Output Formats

Daniel@0:
Daniel@0: The output format is specified with the -Tlang Daniel@0: flag on the command line, where lang Daniel@0: is one of the parameters listed below. Daniel@0:

Daniel@0: The formats actually available in a given Graphviz system depend on Daniel@0: how the system was built and the presence of additional libraries. Daniel@0: To see what formats dot supports, run dot -T?. Daniel@0: See the description of the -T Daniel@0: flag for additional information. Daniel@0:

Daniel@0: Note that the internal coordinate system has the origin Daniel@0: in the lower left corner. Daniel@0: Thus, positions in the Daniel@0: canon, Daniel@0: dot, Daniel@0: xdot, Daniel@0: plain, and Daniel@0: plain-ext Daniel@0: formats need to be interpreted in this manner. Daniel@0:

Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0:
Command-line
parameter
Format
bmp Daniel@0: Windows Bitmap Format
canon Daniel@0:
dot Daniel@0:
xdot Daniel@0:
DOT
cmap Daniel@0: Client-side imagemap (deprecated)
dia Daniel@0: Dia format
eps Daniel@0: Encapsulated PostScript
fig Daniel@0: FIG
gd Daniel@0:
gd2 Daniel@0:
GD/GD2 formats
gif Daniel@0: GIF
gtk Daniel@0: GTK canvas
hpgl Daniel@0: HP-GL/2
ico Daniel@0: Icon Image File Format
imap Daniel@0:
cmapx Daniel@0:
Server-side and client-side imagemaps
imap_np Daniel@0:
cmapx_np Daniel@0:
Server-side and client-side imagemaps
ismap Daniel@0: Server-side imagemap (deprecated)
jpg Daniel@0:
jpeg Daniel@0:
jpe Daniel@0:
JPEG
mif Daniel@0: FrameMaker MIF format
mp Daniel@0: MetaPost
pcl Daniel@0: PCL
pdf Daniel@0: Portable Document Format (PDF)
pic Daniel@0: PIC
plain Daniel@0:
plain-ext Daniel@0:
Simple text format
png Daniel@0: Portable Network Graphics format
ps Daniel@0: PostScript
ps2 Daniel@0: PostScript for PDF
svg Daniel@0:
svgz Daniel@0:
Scalable Vector Graphics
tga Daniel@0: Truevision Targa Format (TGA)
tif Daniel@0:
tiff Daniel@0:
TIFF (Tag Image File Format)
vml Daniel@0:
vmlz Daniel@0:
Vector Markup Language (VML)
vrml Daniel@0: VRML
vtx Daniel@0: Visual Thought format
wbmp Daniel@0: Wireless BitMap format
xlib Daniel@0: Xlib canvas
Daniel@0:


Daniel@0:

Format Descriptions

Daniel@0:
Daniel@0:
bmp Daniel@0:
Outputs images in the Windows BMP format. Daniel@0: Daniel@0:
canon Daniel@0: ,
dot Daniel@0: ,
xdot Daniel@0:
These formats produce output in the Daniel@0: dot language. Daniel@0: Using canon produces a prettyprinted version of the input, Daniel@0: with no layout performed. Daniel@0:

Daniel@0: The dot option corresponds to attributed dot output, Daniel@0: and is the default output format. Daniel@0: It reproduces the input, along with layout information for the graph. Daniel@0: In particular, a bb attribute is Daniel@0: attached to the graph, specifying the bounding box of the drawing. Daniel@0: If the graph has a label, its position is specified by the Daniel@0: lp attribute. Daniel@0:

Daniel@0: Each node gets pos, Daniel@0: width and Daniel@0: height attributes. If the node is a record, Daniel@0: the record rectangles are given in the Daniel@0: rects attribute. Daniel@0: If the node is a polygon and the Daniel@0: vertices attribute is defined, this Daniel@0: attribute contains the vertices of the node. Daniel@0:

Daniel@0: Every edge is Daniel@0: assigned a pos attribute, Daniel@0: and if the edge has a label, the label position Daniel@0: is given in lp. Daniel@0:

Daniel@0: The xdot format extends the Daniel@0: dot format by providing much more detailed information about Daniel@0: how graph components are drawn. It relies on additional attributes Daniel@0: for nodes, edges and graphs. Daniel@0:

Daniel@0: The format is preliminary; comments and Daniel@0: suggestions for better representations are welcome. Daniel@0: To allow for changes in the format, Graphviz attaches the attribute Daniel@0: xdotversion to the graph. Daniel@0:

Daniel@0: Additional drawing attributes can appear on nodes, edges, clusters and Daniel@0: on the graph itself. There are six new attributes: Daniel@0: Daniel@0: Daniel@0:
_draw_Drawing operations Daniel@0:
_ldraw_Label drawing Daniel@0:
_hdraw_Head arrowheadEdge only Daniel@0:
_tdraw_Tail arrowheadEdge only Daniel@0:
_hldraw_Head labelEdge only Daniel@0:
_tldraw_Tail labelEdge only Daniel@0:
Daniel@0:

Daniel@0: For a given graph object, one will typically a draw directive before the Daniel@0: label directive. For example, for a node, one would first use the commands Daniel@0: in _draw_ followed by the commands in _ldraw_. Daniel@0:

Daniel@0: The value of these attributes consists of the concatenation of some Daniel@0: (multi-)set of the following 13 rendering or attribute operations. Daniel@0: (The number is parentheses gives the xdot version when the operation Daniel@0: was added to the format. If no version number is given, the operation Daniel@0: was in the original specification.) Daniel@0: Daniel@0: Daniel@0:
E x0 y0 w h Daniel@0: Filled ellipse ((x-x0)/w)2 + ((y-y0)/h)2 = 1 Daniel@0:
e x0 y0 w h Daniel@0: Unfilled ellipse ((x-x0)/w)2 + ((y-y0)/h)2 = 1 Daniel@0:
P n x1 y1 ... xn yn Daniel@0: Filled polygon using the given n points Daniel@0:
p n x1 y1 ... xn yn Daniel@0: Unfilled polygon using the given n points Daniel@0:
L n x1 y1 ... xn yn Daniel@0: Polyline using the given n points Daniel@0:
B n x1 y1 ... xn yn Daniel@0: B-spline using the given n control points Daniel@0:
b n x1 y1 ... xn yn Daniel@0: Filled B-spline using the given n control points (1.1) Daniel@0:
T x y j w n -b1b2...bn Daniel@0: Text drawn using the baseline point (x,y). The text consists of the Daniel@0: n bytes following '-'. The text should be left-aligned (centered, Daniel@0: right-aligned) on the point if j is -1 (0, 1), respectively. The value Daniel@0: w gives the width of the text as computed by the library. Daniel@0:
C n -b1b2...bn Daniel@0: Set fill color. The color value consists of the Daniel@0: n bytes following '-'. (1.1) Daniel@0:
c n -b1b2...bn Daniel@0: Set pen color. The color value consists of the Daniel@0: n bytes following '-'. (1.1) Daniel@0:
F s n -b1b2...bn Daniel@0: Set font. The font size is s points. The font name consists of the Daniel@0: n bytes following '-'. (1.1) Daniel@0:
S n -b1b2...bn Daniel@0: Set style attribute. The style value consists of the Daniel@0: n bytes following '-'. The syntax of the value is the same as Daniel@0: specified for a styleItem in style. (1.1) Daniel@0:
I x y w h n -b1b2...bn Daniel@0: Externally-specified image drawn in the box with lower left Daniel@0: corner (x,y) and upper right corner (x+w,y+h). The name of the image Daniel@0: consists of the n bytes following '-'. This is usually a bitmap Daniel@0: image. Note that the image size, even when converted from pixels to Daniel@0: points, might be different from the required size (w,h). It is Daniel@0: assumed the renderer will perform the necessary scaling. (1.2) Daniel@0:
Daniel@0:

Daniel@0: Note that the filled figures (ellipses, polygons and B-Splines) Daniel@0: imply two operations: first, drawing the filled figure with the Daniel@0: current fill color; second, drawing an unfilled figure with the Daniel@0: current pen color, pen width and pen style. Daniel@0: the Daniel@0:

Daniel@0: Style values which can be incorporated in the graphics model do not Daniel@0: appear in xdot output. In particular, the style values Daniel@0: filled, rounded, diagonals, and invis Daniel@0: will not appear. Indeed, if style contains invis, Daniel@0: there will not be any xdot output at all. Daniel@0:

Daniel@0: In handling text alignment, the application may want to recompute the Daniel@0: string width using its own rendering primitives. Daniel@0:

Daniel@0: The text operation is only used in the label attributes. Normally, Daniel@0: the non-text operations are only used in the non-label attributes. Daniel@0: If, however, the decorate Daniel@0: attribute is set on an edge, its label Daniel@0: attribute will also contain a polyline operation. Daniel@0: In addition, if a label is a complex, HTML-like label, it will also Daniel@0: contain non-text operations. Daniel@0:

Daniel@0: All coordinates and sizes are in points. Daniel@0: Note though that if Daniel@0: an edge or node is invisible, no drawing operations are attached to it. Daniel@0:

Daniel@0: Version info: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0: Daniel@0:
Xdot versionGraphviz version
1.01.9
1.12.8
1.22.13
Daniel@0: Daniel@0:

cmap Daniel@0:
Produces map files for client-side image maps. The cmap format is Daniel@0: mostly identical to cmapx, but the latter is well-formed XML amenable Daniel@0: to processing by XML tools. In particular, the cmapx output is wrapped in Daniel@0: <map></map>. Daniel@0:

Daniel@0: See Note. Daniel@0: Daniel@0:

dia Daniel@0:
Produces Dia output. Daniel@0: Daniel@0:
eps Daniel@0:
Produces Encapsulated PostScript output. Daniel@0: At present, this is only guaranteed to be correct for a single Daniel@0: input graph since the Bounding Box information has to appear Daniel@0: at the beginning of the output, and this will be based on the first graph. Daniel@0: Daniel@0:
fig Daniel@0:
Outputs graphs in the FIG graphics language. Daniel@0: Daniel@0:
gd Daniel@0: ,
gd2 Daniel@0:
Output images in the GD and GD2 format. These are the internal Daniel@0: formats used by the gd library. The latter is compressed. Daniel@0: Daniel@0:
gif Daniel@0:
Outputs GIF bitmap images. Daniel@0: Daniel@0:
gtk Daniel@0:
Creates a GTK window and displays the output there. Daniel@0: Daniel@0:
hpgl Daniel@0:
Produces output in the HP-GL/2 vector graphic printer language. Daniel@0: Daniel@0:
ico Daniel@0:
Outputs images in the Windows ICO format. Daniel@0: Daniel@0:
imap Daniel@0: ,
cmapx Daniel@0:
Produces map files for server-side and client-side image maps, Daniel@0: These can be used in a web page with Daniel@0: a graphical form of the output, e.g. in JPEG or GIF format, to attach Daniel@0: links to nodes and edges. For example, to create a server-side map Daniel@0: given the dot file Daniel@0:
Daniel@0: /* x.dot */
Daniel@0: digraph mainmap {
Daniel@0:   URL="http://www.research.att.com/base.html";
Daniel@0:   command [URL="http://www.research.att.com/command.html"];
Daniel@0:   command -> output [URL="colors.html"];
Daniel@0: }
Daniel@0: 
Daniel@0: one would process the graph and generate two output files: Daniel@0:
Daniel@0: dot -Timap -ox.map -Tgif -ox.gif x.dot
Daniel@0: 
Daniel@0: and then refer to it in a web page: Daniel@0: Daniel@0: <A HREF="x.map"><IMG SRC="x.gif" ismap="ismap" /></A> Daniel@0: Daniel@0: For client-side maps, one again generates two output files: Daniel@0:
Daniel@0: dot -Tcmapx -ox.map -Tgif -ox.gif x.dot
Daniel@0: 
Daniel@0: and uses the HTML Daniel@0: Daniel@0: <IMG SRC="x.gif" USEMAP="#mainmap" /> Daniel@0: ... [content of x.map] ... Daniel@0: Daniel@0: URLs can be attached to the root Daniel@0: graph, nodes and edges. If a node has a URL, clicking in the node Daniel@0: will activate the link. Daniel@0: If an edge has a URL, various Daniel@0: points along the edge (but not necessarily the head or tail) Daniel@0: will link to it. In addition, if the edge has a Daniel@0: label, that will link Daniel@0: to the URL. Daniel@0: As for the head of the edge, this is linked to the Daniel@0: headURL, if set. Daniel@0: Otherwise, it is linked to the edge's URL if that is defined. Daniel@0: The analogous description holds for the tail and the Daniel@0: tailURL. Daniel@0: A URL associated with the graph is used as a default link. Daniel@0:

Daniel@0: If the URL Daniel@0: of a node contains the escape sequence "\N", it will be replaced by Daniel@0: the node's name. Daniel@0: If the headURL is defined and contains the escape sequence "\N", Daniel@0: it will be replaced by Daniel@0: the headlabel, if defined. Daniel@0: The analogous result holds for the tailURL and the Daniel@0: taillabel. Daniel@0:

Daniel@0: See Note. Daniel@0: Daniel@0:

imap_np Daniel@0: ,
cmapx_np Daniel@0:
These are identical to the imap and cmapx formats, except they Daniel@0: rely solely on rectangles as active areas. Daniel@0: Daniel@0:
ismap Daniel@0:
Produces HTML image map files. This is a predecessor (circa 1994) Daniel@0: of the IMAP format. Most servers now use the latter. Daniel@0: URLs can be attached to the root graph, Daniel@0: nodes and edges. Since edge Daniel@0: links are attached to edge labels, an edge must Daniel@0: have a label for its Daniel@0: URL to be used. For both nodes and edges, if the URL has the escape Daniel@0: sequence "\N" embedded in its string, this will be replaced with the Daniel@0: node or edge name. Daniel@0: Daniel@0:
jpg Daniel@0: ,
jpeg Daniel@0: ,
jpe Daniel@0:
Output JPEG compressed image files. Daniel@0: Daniel@0:
mif Daniel@0:
Generates Frame Maker MIF files. Daniel@0: Daniel@0:
mp Daniel@0:
Produces MetaPost output. Daniel@0: Daniel@0:
pcl Daniel@0:
Produces output in the PCL printer language. Daniel@0: HP-GL is a subset of Daniel@0: PCL, so that PCL output is the same as HP-GL, wrapped with some initial Daniel@0: and final commands to set the printer to and from HP-GL mode. Daniel@0: Daniel@0:
pdf Daniel@0:
Produces PDF output. Daniel@0: (This option assumes Graphviz includes the Cairo renderer.) Daniel@0: Alternatively, one can use the ps2 option to Daniel@0: produce PDF-compatible PostScript, and then use a ps-to-pdf converter. Daniel@0:

Daniel@0: Note: At present, this option does not support anchors, etc. To get these Daniel@0: included in your PDF output, use ps2. Daniel@0: Daniel@0:

pic Daniel@0:
Outputs in PIC, the picture description language in the troff-family Daniel@0: Daniel@0:
plain Daniel@0: ,
plain-ext Daniel@0:
The plain and plain-ext formats produce output using Daniel@0: a simple, line-based language. Daniel@0: The latter format differs in that, on edges, it provides port names Daniel@0: on head and tail nodes when applicable. Daniel@0:

Daniel@0: There are four types of statements. Daniel@0:

Daniel@0:  graph scale width height
Daniel@0:  node name x y width height label style shape color fillcolor
Daniel@0:  edge tail head n x1 y1 .. xn yn [label xl yl] style color
Daniel@0:  stop
Daniel@0: 
Daniel@0:
Daniel@0:
graph Daniel@0:
The width and height values give the width and height Daniel@0: of the drawing. The lower left corner of the drawing is at the origin. Daniel@0: The scale value indicates how the drawing should be scaled Daniel@0: if a size attribute was given and the drawing Daniel@0: needs to be scaled to conform to that size. If no scaling is necessary, Daniel@0: it will be set to 1.0. Note that all graph, node and edge Daniel@0: coordinates and lengths are given unscaled. Daniel@0:
node Daniel@0:
The name value is the name of the node, and x and y Daniel@0: give the node's position. The width and height are the Daniel@0: width and height of the node. Daniel@0: The label, Daniel@0: style, shape, color and fillcolor give the Daniel@0: node's label, Daniel@0: style, shape, Daniel@0: color and Daniel@0: fillcolor, Daniel@0: respectively, using attribute default values where necessary. If the Daniel@0: node does not have a style attribute, "solid" is used. Daniel@0:
edge Daniel@0:
The tail and head values give the names of the head and Daniel@0: tail nodes. In plain-ext format, the head or tail name will be appended Daniel@0: with a colon and a portname if the edge connects to the node at a port. Daniel@0: n is the number of control points defining the Daniel@0: B-spline forming the edge. This is followed by 2*n numbers giving Daniel@0: the x and y coordinates of the control points in order from tail to head. Daniel@0: If the edge has a label, this comes next Daniel@0: followed by the x and y coordinates of the label's position. Daniel@0: The edge description is completed by the edge's Daniel@0: style and color. Daniel@0: As with nodes, if a style is not defined, "solid" is used. Daniel@0:

Daniel@0: Note: The control points given in an edge statement define the Daniel@0: body of the edge. In particular, if the edge has an arrowhead to the Daniel@0: head or tail node, Daniel@0: there will be a gap between the last or first control points and the Daniel@0: boundary of the associated node. There are at least 3 possible ways Daniel@0: of handling this gap: Daniel@0:

    Daniel@0:
  • Arrange that the input graph uses dir=none, Daniel@0: arrowhead=none, or arrowtail=none for all edges. Daniel@0: In this case, the terminating control points will always touch the node. Daniel@0:
  • Consider the line segment joining the control point and the center Daniel@0: of the node, and determine the point where the segment intersects the Daniel@0: node's boundary. Then use the control point and the intersection point Daniel@0: as the main axis of an arrowhead. The problem with this approach is Daniel@0: that, if the edge has a port, the edge will not be pointing to the Daniel@0: center of the node. In this case, rather than use the control point Daniel@0: and center point, one can use the control point and its tangent. Daniel@0:
  • Arrange that the input graph uses headclip=false or Daniel@0: tailclip=false. In this case, the edge will terminate at Daniel@0: the node's center rather than its boundary. If arrowheads are used, Daniel@0: there will still be a gap, but normally this will occur within the Daniel@0: node. The application will still need to clip the spline to the node Daniel@0: boundary. Also, as with the previous item, if the edge points to Daniel@0: a node port, this technique will fail. Daniel@0:
Daniel@0:
Daniel@0: The output consists of one graph line, a sequence of Daniel@0: node lines, one per node, a sequence of Daniel@0: edge lines, one per edge, and a final stop Daniel@0: line. All units are in inches, represented by a floating point number. Daniel@0:

Daniel@0: Note that the plain formats provide minimal information, really giving not Daniel@0: much more than node positions and sizes, and edge spline control points. Daniel@0: These formats are usually most useful to applications wanting just this Daniel@0: geometric information, and willing to fill in all of the graphical details. Daniel@0: The only real advantages to these formats is their terseness and their Daniel@0: ease of parsing. In general, the dot and Daniel@0: xdot are preferable in terms of the quantity of Daniel@0: information provided. Daniel@0: Daniel@0:

png Daniel@0:
Produces output in the PNG (Portable Network Graphics) format. Daniel@0: Daniel@0:
ps Daniel@0:
Produces PostScript output. Daniel@0:

Daniel@0: Note: The default PostScript renderer can only handle the Latin-1 Daniel@0: character set. To get non-Latin-1 characters into PostScript output, Daniel@0: use -Tps:cairo, assuming your version was built with the Daniel@0: Cairo renderer. Daniel@0: Daniel@0:

ps2 Daniel@0:
Produces PostScript output with PDF notations. It is assumed the output Daniel@0: will be directly converted into PDF format. The notations include PDF Daniel@0: bounding box information, so that the resulting PDF file can be correctly Daniel@0: used with pdf tools, such as pdflatex. Daniel@0: In addition, if a node has a URL Daniel@0: attribute, this gets translated into PDF code such that the node, Daniel@0: when viewed in a PDF-viewer, e.g., Daniel@0: acroread, Daniel@0: is a link to the given URL. If a URL is attached to the graph, this serves Daniel@0: as a base, such that relative URLs on nodes are derived from it. Daniel@0: Daniel@0:
svg Daniel@0: ,
svgz Daniel@0:
Produce SVG output, Daniel@0: the latter in compressed format. Daniel@0:

Daniel@0: See Note. Daniel@0: Daniel@0:

tga Daniel@0:
Produces Targa output. Daniel@0: Daniel@0:
tif Daniel@0: ,
tiff Daniel@0:
Produces TIFF output. Daniel@0: Daniel@0:
vml Daniel@0: ,
vmlz Daniel@0:
Produces VML output, Daniel@0: the latter in compressed format. Daniel@0:

Daniel@0: See Note. Daniel@0: Daniel@0:

vrml Daniel@0:
Outputs graphs in the VRML format. Daniel@0: To get a 3D embedding, nodes must have a z Daniel@0: attribute. These can either be supplied as part of the input graph, or Daniel@0: be generated by neato provided dim=3 Daniel@0: and at least one node has a z value. Daniel@0:

Daniel@0: Line segments are drawn as cylinders. Daniel@0: In general, VRML output relies on having the PNG library to produce images Daniel@0: used to texture-fill the node shapes. However, if Daniel@0: shape=point, Daniel@0: a node is drawn as a 3D sphere. Daniel@0: Daniel@0:

vtx Daniel@0:
Generates graph diagrams in the format for Daniel@0: Confluents's Visual Thought. Daniel@0: Daniel@0:
wbmp Daniel@0:
Produces output in the Wireless BitMap (WBMP) format, optimized for Daniel@0: mobile computing. Daniel@0: Daniel@0:
xlib Daniel@0:
Creates an Xlib window and displays the output there. Daniel@0: Daniel@0:
Daniel@0:
Daniel@0: Daniel@0: Daniel@0:

Image Formats

Daniel@0:
Daniel@0: The image and shapefile attributes specify an image file to be included Daniel@0: as part of the final diagram. Not all image formats can be read. In addition, Daniel@0: even if read, not all image formats can necessarily be used in a given Daniel@0: output format. Daniel@0:

Daniel@0: The graph below shows what image formats can be used in which output formats, Daniel@0: and the required plugins. On the left are the supported image formats. Daniel@0: On the right are the supported output formats. Daniel@0: In the middle are the plugins: image loaders, renderers, drivers, arranged by Daniel@0: plugin library. Daniel@0: This presents the most general case. A given installation may not provide Daniel@0: one of the plugins, in which case, that transformation is not possible. Daniel@0:
Daniel@0: Daniel@0:


Daniel@0:

Notes

Daniel@0:
    Daniel@0:
  1. Daniel@0: In the formats: -Tcmap, -Tcmapx, -Tsvg, -Tvml, the output generates Daniel@0: 'id="node#"' properties for nodes, 'id="edge#"' properties for edges, and 'id="cluster#"' properties for clusters, with the '#' replaced by an internally assigned integer. These strings can be provided instead by an externally provided "id=xxx" attribute on the object. Daniel@0: Normal "\N" "\E" "\G" substitutions are applied. Daniel@0: Externally provided id values are not used internally, and it is the use's reponsibilty to ensure Daniel@0: that they are sufficiently unique for their intended downstream use. Daniel@0: Note, in particular, that "\E" is not a unique id for multiedges. Daniel@0: