Graph Attributes for Rgraphviz

Share:

Description

The following describes the allowable attributes to be used with Rgraphviz. Most of these are sent directly to Graphviz and will influence the plot layout, some of these are only cosmetic and stay in R. Users are referred to the Graphviz web documentation which contains some more detailed information on these attributes (and is our source).

Graph Attributes

General Graph Attributes:

bgcolor:

Color for the entire canvas. The default is to use transparent

center:

Drawing is centered in the output canvas. This is a boolean value with a default of FALSE.

fontcolor:

Color used for text, defaulting to black.

fontname:

Font used for text. Default is Times Roman.

fontpath:

Directory used to search for fonts

fontsize:

Font size, in points, for text. This attribute accepts doubles for values with a default of 14.0 and a minimum value of 1.0

label:

Label for the graph. This is a string with some extra escape sequences which can be used. The substring \N is replaced by the name of the node, and the substring \G by the name of the graph. For graph or cluster attributes, \G is replaced by the name of the graph or cluster. For edge attributes, the substring \N is replaced by the name of the edge, and the substrings \T and \H by the names of the tail and head nodes. The default value for nodes is \N with everything else defaulting to

labeljust:

Subgraphs inherit cluster behavior for labeljust. If r, the labels are right-justified within the bounding rectangle. If l they are left-justified. Otherwise the labels are centered. The default value is c.

labelloc:

Top/bottom placement for graph labels. A value of t places the label at the top, b places them at the bottom. By default root graph labels go on the bottom and cluster labels go on the top.

layers:

Specifies a linearly ordered list of layer names attached to the graph. Only those components belonging to the current layer appear. This attribute accepts a layerList, which is list of strings separated by the characters defined with the layersep attribute which defines layer names and implicitly numbered 1,2,etc. The default is which only uses one layer.

layersep:

Separator characters used to split the layers into a list of names. The default is colons, tabs or spaces.

margin:

Set X&Y margins of canvas in inches. Specified using the notation val,val where each val is a double.

orientation:

If "[1L*]*", set graph orientation to landscape. Used only if rotate is not defined. Default is the empty string.

page:

Width & height of output pages, in inches. If set and smaller then the size of the layout, a rectangular array of pages of the specified page size is overlaid on the layout, with origins aligned in the lower-left corner, thereby partitioning the layout into pages. The pages are then produced one at a time in 'pagedir' order. Specified using the notion val,val where each val is a double.

pagedir:

If the page attribute is set and applicable, this attribute specifies the order in which the pages are emitted. This is limited to one of the 8 row or column major orders. One of BL, BR, TR, RB, RT, LB, or LT specifying the 8 row or column major orders for traversing a rectangular array (the first character corresponding to the major order and the second to the minor order). The default value is BL

quantum:

If 'quantum' > 0.0, node label dimensions will be rounded to integral multiples of the quantum. This attribute is of type double, with a default and minimum value of 0.0

ranksep:

In dot, this gives the desired rank separation in inches. If the value contains equally, the centers of all the ranks are spaced equally apart. In twopi, specifies the separation of concentric circles. This value is of type double, with a minimum value of 0.02. In dot, the default value is 0.5 and for twopi it is 1.0.

ratio:

Sets the aspect ratio for the drawing. If numeric, defines aspect ratio. If it is 'fill' and 'size' has been set, node positions are scaled such that the final drawing fills exactly the specified size. If 'compress' and the 'size' attribute is set and the graph can not be drawn on a single page, then the drawing is compressed to fit in the given size. If 'auto', the 'page' attribute is set and the graph cannot be drawn on a single page, then 'size' is set to an “ideal” value. The default for this attribute is “fill”

rotate:

If 90, set drawing orientation to landscape. This attribute accepts integer values and defaults to 0

samplepoints:

If the input graph defines the 'vertices' attribute, and output is dot or xdot, this gives the number of points used to represent circles and ellipses. It plays the same role in neato, when adjusting the layout to avoid overlapping nodes. This attribute accepts integer values and defaults to 8

size:

Maximum width and height of drawing, in inches. Specified using the notation val,val where each val is a double. If not specified and there is a current output device, the graph is scaled to fit into that device. If size is not specified and there is no current output device, a plot region of the default size will be opened and the graph scaled to match that.

start:

Parameter used to determine the initial layout of nodes. By default, nodes are randomly placed in a square whose sides have length (number of nodes). The same seed is always used for the random number generator, so the initial placement is repeatable. If 'start' converts to an integer, this is used as a seed value for the RNG. If 'start' is "regular", the nodes are placed regularly about a circle. Finally if 'start' is defined, and not one of those cases, the current time is used to pick a seed. The default is the empty string.

Dot Only Attributes

clusterrank:

Mode used for handling clusters. If "local", a subgraph whose name begins with "cluster" is given special treatment. The subgraph is laid out separately, and then integrated as a unit into its parent graph. If the cluster has a 'label' parameter, this label is displayed w/ the cluster. Acceptable values are local, global or none - with local being the default.

compound:

Allow edges between clusters. This is a boolean value with a default of FALSE

concentrate:

Use edge concentrators. This is a boolean value with a default of FALSE

mclimit:

Scale factor used to alter the 'MinQuit' and 'MaxIter' parameters used during crossing minimization. This is a double value with a default of 1.0

nodesep:

Minimum space between two adjacent nodes of the same rank, in inches. This is a double value with a default of 0.25 and a minimum of 0.02

ordering:

If out for a graph and n is a node in G, then edges n->* appear left to right in the order that they were defined.

rankdir:

Determines if the layout is left-to-right or top-to-bottom. Acceptable values are LR and TB with the default being the latter.

remincross:

If TRUE and there are multiple clusters, run cross minimization a second time. Default is FALSE

searchsize:

During network simplex, maximum number of edges with negative cut values to search when looking for one with minimum cut value. This is an integer value with a default of 30

showboxes:

Debugging feature for postscript output, R only. Not currently implemented.

Neato Only Attributes

Damping:

Factor damping force motions. On each iteration, a node's movement is limited to this factor of its potential motion. This is a double value with a default of 0.99 and a minimum value of 0.0

defaultdist:

Default distance between nodes in separate connected components. Only applicable if pack=FALSE. Defaults to 1+(avg. len)*sqrt(|V|) and has a minimum value of epsilon.

dim:

Set the number of dimensions used for the layout. This is an integer value with a default and minimum value of 2.

epsilon:

Terminating condition. If length squared of all energy gradients are less than epsilon, the algorithm stops. This is a double value with a default of .0001 times the number of nodes.

maxiter:

Sets the number of iterations used. This is an integer value with the default of MAXINT.

model:

If circuit, use circuit resistance model to compute dissimilarity values, otherwise use shortest path. Defaults to the empty string.

Twopi Only Attributes

root:

Name of the node to use as the center of the layout. If not defined, will pick the most central node.

Not Dot Attributes

normalize:

Normalize coordinates of final layout so that the first point is at the origin, then rotate so that the first edge is horizontal. This is a boolean value with a default of FALSE.

overlap:

If scale, remove node overlaps by scaling. If FALSE, use Voronoi technique, otherwise leave overlaps. Default is the empty string.

pack:

If "true" or non-negative integer - each connected component is laid out separately and then the graphs are packed tightly. If pack has an integral value, this is used as the size (in points) of a margin around each part; otherwise a default margin of 8 is used. If 'false', the entire graph is laid out together. For twopi layouts, this just sets the margin. Default is FALSE

packmode:

Indicates the granularity and method used for packing. This will automatically turn on pack. Acceptable values are node, clust and graph, specifying the granularity of packing connected components when pack=TRUE. The default is node.

sep:

Fraction to increase polygons for purposes of determining overlap. This is a double value with a default of 0.01.

splines:

Draw edges as splines. This is a boolean value with a default of TRUE.

voro_margin:

Factor to scale up drawing to allow margin for expansion in Voronoi technique. This is a double value with a default of 0.05 and a minimum value of 0.0

Output Based

resolution:

Number of pixels per inch on a display, used for SVG output. The default for this attribute is 0.96 and it accepts values of type double.

stylesheet:

A URL or pathname specifying a XML style sheet, for SVG output.

truecolor:

Output relies on a truecolor color model, used with bitmap outputs. This is a boolean value with a default of FALSE

Misc

URL:

Hyperlink incorporated into the output. For whole graphs, used as part of an image map. Not currently implemented

comment:

A device dependent commentary. Not currently implemented.

nslimit:

Number of iterations in network simplex applications. Used in computing node x coordinates

nslimit1:

Same as nslimit but for ranking nodes

outputorder:

Specify order in which nodes and edges are drawn. R only

Edge Attributes

General Edge Attributes

arrowhead:

Shape of the arrowhead. Currently somewhat limited in what can be rendered in R as opposed to what is available via Graphviz in that only open and none are allowed. The open is used by default for directed edges and none for undirected edges. R only(?)

arrowsize:

Multiplicative scale factor for arrowheads, type double. R only (?). This attribute accepts values of type double with a default of 1.0 and minimum of 1.0.

arrowtail:

Style of arrow on the tail node of an edge, see arrowhead. For directed edges that with bidirectional arrows, open is used. R only(?)

color:

The color of the edge. Defaults to black.

decorate:

If TRUE, attach edge label to edge by a 2-segment polyline, underlining the label, then going to the closest point of the spline. Default is FALSE. Currently unimplemented.

dir:

Edge type drawing, which ends should get the arrowhead. R only(?). For directed graphs, this defaults to forward and undirected graphs default to both. Other possible values are both (arrows in both directions) and back (Arrow on the tail only)

fontcolor:

The color used for text. The default value is black in R

fontname:

Font used for text. Defaults to Times Roman. Currently unimplemented.

fontsize:

Font size, used for text. Defaults to 14.0 with a minimum value of 1.0

headclip:

Head of the edge is clipped to the boundary of the head node, otherwise it goes to the center of the node. This is a boolean value with the default of TRUE. Currently unimplemented

headlabel:

Label for the head of the edge. See label in Graph Attributes for a description of additional escape sequences. Currently unimplemented.

headport:

Where on the node to aim the edges, uses center, n, s, e, nw, nw, se, and sw. The default is center.

label:

The edge label. See label in Graph Attributes for a description of additional escape sequences.

labelangle:

Angle in degrees that the label is rotated, as a double. Default is -25.0 with a minimum value of -180.0. Currently unimplemented.

labeldistance:

Multiplicative scaling factor adjusting the distance that the label is from the node. This is a double value with a default of 1.0 and a minimum value of 0.0.

layer:

Specifies the layers that this edge is present, type of layerRange. This is specified as a string in the format layerID or layerIDslayerIDslayerID..., where s is a character from the layersep attribute. The layerID attribute can be all, a decimal integer or a layer name. Defaults to the empty string.

style:

Set line style for the edge. R only. Can be one of dashed, dotted, solid, invis and bold. Defaults to solid.

tailclip:

Same as headclip except for the tail of the edge. Defaults to TRUE. Currently unimplemented.

taillabel:

Same as headlabel except for the tail of the edge. Defaults to the empty string. Currently unimplemented.

weight:

The weight of the edge. This attribute is of type double with a default of 0.75 and a minimum value of 0.01.

Dot Only Attributes

constraint:

If FALSE, edge is not used in ranking nodes. Default is TRUE.

lhead:

Logical head of an edge. If compound is TRUE, if lhead is defined and is the name of a cluster containing the real head, then the edge is clipped to the boundary of the cluster.

ltail:

Same as lhead but for the tail of the edge

minlen:

Minimum edge length (rank difference between head and tail). This is an integer value with a default of 1 and a minimum of 0.

samehead:

Edges with the same head and samehead value are aimed at the same point on the head node.

sametail:

Same as samehead but for the tail of the edge.

Neato Only Attributes

len:

Preferred edge length, in inches. This attribute accepts double values with a default of 1.0.

Misc

URL:

Hyperlink incorporated into the output. Not currently supported

headURL:

URL for the head of the edge. Not currently supported

headtooltip:

If there's a headURL, annotation for a tooltip. R only, not currently supported

tailURL:

Same as headURL but for the tail of an edge

tailtooltip:

Same as headtooltip but for the head of an edge

tooltip:

Same as headtooltip but for the edge in general

showboxes:

Debugging feature for postscript. Not currently supported

comment:

Device dependent comment inserted into the output. Not currently supported

Node Attributes

General Node Attributes

color:

Basic drawing color for the node, corresponding to the outside edge of the node. The interior of the node is specified with the fillcolor attribute. Defaults to black.

distortion:

Distortion factor for shape=polygon, positive values cause top to be larger then bottom, negative is opposite. This is a double value with a default of 0.0 and a minimum value of -100.0

fillcolor:

Background color of the node. This defaults to black.

fixedsize:

Use only width and height attributes, do not expand for the width of the label. This defaults to TRUE.

fontcolor:

Color used for text. This defaults to black.

fontname:

Font used for text. The default of this is Times Roman.

fontsize:

Size of font for the text. This defaults to 14.0 with a minimum size of 1.0.

height:

Height of the node, in inches. This attribute accepts values as doubles with a default of 0.5 and a minimum value of 0.02.

label:

Label for the node. See label in Graph Attributes for an explanation of extra escape sequences.

layer:

Layers in which the node is present. See layer in Edge Attributes for an explanation of acceptable inputs.

peripheries:

Set number of peripheries used in polygonal shapes and cluster boundaries. Note that user-defined shapes are treated as a form box shape, so the default peripheries value is 1 and the user-defined shape will be drawn in a bounding rectangle. Setting peripheries=0 will turn this off. Also, 1 is the maximum peripheries value for clusters. Not currently implemented.

pos:

Position of the node (For neato layouts, this is the initial position of the node). Specified using the notion val,val where each val is a double.

regular:

Force the polygon to be regular. Defaults to FALSE.

shape:

The shape of the node. Current acceptable values are circle, rectangle, rect, box and ellipse. The circle shape is the default. Note that box, rect and rectangle all correspond to the same actual shape.

sides:

Number of sides if shape=polygon. This is an integer value with a default value of 4 and a minimum value of 0.

skew:

Skew factor for shape=polygon. Positive values skew the polygon to the right, negative to the left. This is a double value with a default value of 0.0 and a minimum value of -100.0.

style:

Set style for the node boundary. R only. Can be one of dashed, dotted, solid, invis and bold. Defaults to solid.

width:

Width of the node, in inches. Default is 0.75 with a minimum value of 0.01

Dot Only Attributes

group:

If the end points of an edge belong to the same group, ie they have the same group attributes, parameters are set to avoid crossings and keep the edges straight

Neato Only Attributes

pin:

If TRUE and node has a pos attribute on input, neato prevents the node from moving from the input position. The default for this attribute is FALSE.

Misc

tooltip:

Annotated tooltip if URL exists. R only. Currently unsupported

toplabel:

Label near the top of nodes of shape M*. Currently unsupported

URL:

Hyperlink incorporated into the output. Not currently supported

bottomlabel:

Same as toplabel but for the bottom of the node

comment:

Device dependent comment inserted into the output. Not currently supported

shapefill:

If non-empty, if output is ps or svg and shape is 'espf', taken as a filename containing a device-dependent description of a node's shape. If non-empty for bitmap output (gif, jpg, etc), and shape set to 'custom', taken as the URL for a file containing the bitmap image for the node. For files on the local machine, the URL begins with "file://". For remote files, graphviz must have been configured to use a command such as curl to retrieve the files remotely. Currently unsupported

z:

Provides z coordinates for the node in a 3D system. Currently unsupported

details

Different attributes are appropriate for different specific graph layout algorithms. Graphviz supports three different layout algorithms, dot, neato and twopi.

There is some tension between attributes that graphviz supports and those that we can support at the R level. Please let us know if there are situations that are not being handled appropriately.

All attributes are passed down to graphviz. However they can be later modified for rendering in R.

Author(s)

Jeff Gentry

References

http://www.graphviz.org/pub/scm/graphviz2/doc/info/attrs.html

See Also

plot.graph, agopen, GraphvizLayouts

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.