Learn R Programming

bnlearn (version 2.6)

plot.bn: Plot a Bayesian network

Description

Plot the graph associated with a small Bayesian network.

Usage

## S3 method for class 'bn':
plot(x, ylim = c(0,600), xlim = ylim, radius = 250,
  arrow = 35, highlight = NULL, color = "red", ...)

Arguments

See Also

graphviz.plot.

Examples

Run this code
data(learning.test)
res = gs(learning.test)

plot(res)

## highlight node B and related arcs.
plot(res, highlight = "B")
## highlight B and its Markov blanket.
plot(res, highlight = c("B", mb(res, "B")))

## a more compact plot.
par(oma = rep(0, 4), mar = rep(0, 4), mai = rep(0, 4),
  plt = c(0.06, 0.94, 0.12, 0.88))
plot(res)

Run the code above in your browser using DataLab