wolffd@0: wolffd@0: wolffd@0: wolffd@0: wolffd@0: Output Formats wolffd@0: wolffd@0: wolffd@0: wolffd@0:

Output Formats

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

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

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

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


wolffd@0:

Format Descriptions

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

wolffd@0: See Note. wolffd@0: wolffd@0:

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

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

wolffd@0: See Note. wolffd@0: wolffd@0:

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

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

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

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

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

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

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

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

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

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

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

wolffd@0: See Note. wolffd@0: wolffd@0:

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

wolffd@0: See Note. wolffd@0: wolffd@0:

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

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

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

Image Formats

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

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


wolffd@0:

Notes

wolffd@0:
    wolffd@0:
  1. wolffd@0: In the formats: -Tcmap, -Tcmapx, -Tsvg, -Tvml, the output generates wolffd@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. wolffd@0: Normal "\N" "\E" "\G" substitutions are applied. wolffd@0: Externally provided id values are not used internally, and it is the use's reponsibilty to ensure wolffd@0: that they are sufficiently unique for their intended downstream use. wolffd@0: Note, in particular, that "\E" is not a unique id for multiedges. wolffd@0: