Command-line Invocation

本文介绍了Graphviz程序的基本用法,包括命令行参数设置、输入输出文件处理、布局算法选择及输出格式指定等内容,并提供了环境变量配置说明。
All Graphviz programs have a similar invocation:
cmd[flags] [input files]
If no input files are supplied, the program reads from stdin .

Flags

-G name[= value]
Set a graph attribute, with default value= true.
-N name[= value]
Set a default node attribute, with default value= true.
-E name[= value]
Set a default edge attribute, with default value= true.
-K layout
Specifies which default layout algorithm to use, overriding the default from the command name. For example, running dot -Kneatois equivalent to running neato.
-T format[: renderer[: formatter]]
Set output language to one of the supported formats. By default, attributed dotis produced.

Depending on how Graphviz was built, there may be multiple renderers for generating a particular output format, and multiple formatters for creating the final output. For example, a typical installation can producePNGoutput using either the Cairo or GD library. The desired rendering engine can be specified after a colon. If there are multiple formatting engines available, the desired one can be specified in a similar fashion after the rendering engine. Thus,-Tpng:cairospecifies PNG output produced by Cairo (using the Cairo's default formatter), and-Tpng:cairo:gdspecifies PNG output produced by Cairo formatted using the GD library.

If no renderer is specified, or a renderer but no formatter, the default one is invoked. The flag-Tformat:produces a list of all of the renderers available for the specifiedformat, the first one listed with a prefix matchingformatbeing the default. Using the-vflag, described below, will print which format, renderer, and formatter are actually used.

-V
Emit version information and exit.
-l library
User-supplied, device-dependent library text. Multiple flags may be given. These strings are passed to the code generator at the beginning of output.

For PostScript output, they are treated as file names whose content will be included in the preamble after the standard preamble. Iflibraryis the empty string"", the standard preamble is not emitted.

-n[num]
Sets no-op flag in neato. If set, neatoassumes nodes have already been positioned and all nodes have a posattribute giving the positions. It then performs an optional adjustment to remove node-node overlap, depending on the value of the overlapattribute, computes the edge layouts, depending on the value of the splinesattribute, and emits the graph in the appropriate format. If numis supplied, the following actions occur:
num= 1
Equivalent to -n.
num> 1
Use node positions as specified, with no adjustment to remove node-node overlaps, and use any edge layouts already specified by the posattribute. neatocomputes an edge layout for any edge that does not have a posattribute. As usual, edge layout is guided by the splinesattribute.
-o outfile Write output to file outfile. By default, output goes to stdout. -O Automatically generate output file names based on the input file name and the various output formats specified by the -Tflags. -P Automatically generate a graph that shows the plugin configuration of the current executable. e.g. dot -P -Tps | lpr -q Suppress warning messages. -s[ scale] Set input scale to scale. If this value is omitted, 72.0 is used. This number is used to convert the point coordinate units used in the posattribute into inches, which is what is expected by neato and fdp. Thus, feeding the output of a graph laid out by one program into neato or fdp almost always requires this flag. Ignored if the -nflag is used. -v Verbose mode -x In neato, on input, prune isolated nodes and peninsulas. This removes uninteresting graph structure and produces a less cluttered drawing. -y By default, the coordinate system used in generic output formats, such as attributed dot, extended dot, plainand plain-ext, is the standard cartesian system with the origin in the lower left corner, and with increasing y coordinates as points move from bottom to top. If the -yflag is used, the coordinate system is inverted, so that increasing values of y correspond to movement from top to bottom. -? Print usage information, then exit.

If multiple -T flags are given, drawings of the graph are emitted in each of the specified formats. Multiple -o flags can be used to specify the output file for each format. If there are more formats than files, the remaining formats are written to stdout .

Note that the-G,-Nand-Eflags override any initial attribute declarations in the input graph, i.e., those attribute statements appearing before any node, edge or subgraph definitions. In addition, these flags cause the related attributes to be permanently attached to the graph. Thus, if attributed dot is used for output, the graph will have these attributes.

Environment Variables

GDFONTPATH
List of pathnames giving directories which a program should search for fonts. Overridden by DOTFONTPATH.Used only if Graphviz is not built with the fontconfiglibrary
DOTFONTPATH
List of pathnames giving directories which a program should search for fonts. Overridden by fontpath.Used only if Graphviz is not built with the fontconfiglibrary
SERVER_NAME
If defined, this indicates that the software is running as a web application, which restricts access to image files. See GV_FILE_PATH.
GV_FILE_PATH
If SERVER_NAMEis defined, image files are restricted to exist in one of the directories specified by GV_FILE_PATH. This last is a list of directory pathnames, separated by semicolons in Windows or by colons otherwise. Note that sometimes, when using one of the layout programs in a web script, it is not enough to use an export command but rather the variables should be set when the command is run, for example,
SERVER_NAME=xxx GV_FILE_PATH="images:etc/images:/usr/share/images" dot -Tpng -o x.png x.gv

Note that the image files must really reside in one of the specified directories. If the image file is specified as an absolute or relative pathname, a warning is given and only the base name is used.

GVBINDIR
Indicates which directory contains the Graphviz config file and plug-in libraries. If it is defined, the value overrides any other mechanism for finding this directory. If Graphviz is properly installed, it should not be needed, though it can be useful for relocation on platforms not running Linux or Windows.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值