Plot the graph associated with a Bayesian network using the Rgraphviz package.
graphviz.plot(x, highlight = NULL, groups, layout = "dot",
shape = "circle", main = NULL, sub = NULL, render = TRUE)
an object of class bn
or bn.fit
.
a list, see below.
a list of character vectors, representing groups of node labels of nodes that should be plotted close to each other.
a character string, the layout argument that will be passed to
Rgraphviz. Possible values are dots
, neato
,
twopi
, circo
and fdp
. See Rgraphviz
documentation for details.
a character string, the shape of the nodes. Can be circle
,
ellipse
or rectangle
.
a character string, the main title of the graph. It's plotted at the top of the graph.
a character string, a subtitle which is plotted at the bottom of the graph.
a logical value. If TRUE
, graphviz.plot()
actually
draws the figure in addition to returning the corresponding graph
object. If FALSE
, no figure is produced.
graphviz.plot()
returns invisibly the graph
object produced from
the network passed as the x
argument. It can be further modified using
the graph and Rgraphviz packages.
The highlight
argument is a list with at least one of the following
elements:
nodes
: a character vector, the labels of the nodes to be
highlighted.
arcs
: the arcs to be highlighted (a two-column matrix, whose
columns are labeled from
and to
).
and optionally one or more of the following graphical parameters:
col
: an integer or character string (the highlight colour for
the arcs and the node frames). The default value is red
.
textCol
: an integer or character string (the highlight colour
for the labels of the nodes). The default value is black
.
fill
: an integer or character string (the colour used as a
background colour for the nodes). The default value is transparent
.
lwd
: a positive number (the line width of highlighted arcs).
It overrides the line width settings in strength.plot()
. The
default value is to use the global settings of Rgraphviz.
lty
: the line type of highlighted arcs. Possible values are
0, 1, 2, 3, 4, 5, 6, "blank", "solid", "dashed", "dotted", "dotdash",
"longdash" and "twodash". The default value is to use the global
settings of Rgraphviz.
Note that all these parameters take a single value that is then applied to all nodes and arcs that will be highlighted.