Last data update: 2014.03.03

R: Plotting Utilities Probabilistic Graphical Network
plot.HydeNetworkR Documentation

Plotting Utilities Probabilistic Graphical Network

Description

Plotting Utilities Probabilistic Graphical Network

Usage

## S3 method for class 'HydeNetwork'
plot(x, customNodes = NULL, customEdges = NULL, ...,
  removeDeterm = FALSE, useHydeDefaults = TRUE)

mergeCustomNodes(node_df, customNodes)

mapEdges(n, p)

mergeCustomEdges(edge_df, customEdges)

customNode(node_id, ...)

HydePlotOptions(variable = NULL, determ = NULL, decision = NULL,
  utility = NULL, restorePackageDefaults = FALSE)

Arguments

x

an object of class HydeNetwork

customNodes

a data frame giving additional specifications for nodes. The customizations provided here will override the default settings.

customEdges

a data frame giving custom settings for edges (arrows) between nodes.

...

for the plot method, additional arguments to be passed to DiagrammeR::render_graph. For customNode, named node attributes to assign to a node's plotting characteristics.

removeDeterm

A logical value. When FALSE (the default), it has no effect. When TRUE, deterministic nodes are removed from the network and a reduced plot with no deterministic nodes is rendered.

useHydeDefaults

A logical value indicating if the default plot parameters in options("Hyde_plotOptions") should be applied to the plot.

node_df

A data frame of node attributes

n

node names from a network object

p

the list of parents from a network object

edge_df

The default edge attribute data frame

node_id

The name of a node in a HydeNetwork object. May be quoted or unquoted.

variable,determ,decision,utility

Named lists of attributes to use as defaults node attribute settings for each variable type.

restorePackageDefaults

A logical value. When TRUE, the original package defaults are restored.

Details

Generate and customize plots of a HydeNetwork class network. HydeNet provides some initial defaults for standard variable nodes, deterministic nodes, decision nodes, and utility nodes. Since these nodes are assumed to be of inherent difference and interest, the options are defined in a way to make these easier to identify in a plot. The default options may be altered by the user to their liking by invoking HydePlotOptions. Node attributes are more fully explained in the documentation for the DiagrammeR package. Individual nodes may be define with customNode.

Author(s)

Jarrod Dalton and Benjamin Nutter

Source

http://rich-iannone.github.io/DiagrammeR/graphviz_and_mermaid.html
See especially the section on Attributes

http://graphviz.org/
http://graphviz.org/content/attrs

Examples

## Not run: 
#* Plots may open in a browser.
data(BlackJack, package="HydeNet")
plot(BlackJack)

HydePlotOptions(variable=list(shape = "rect", fillcolor = "#A6DBA0"),
                determ = list(shape = "rect", fillcolor = "#E7D4E8",
                              fontcolor = "#1B7837", linecolor = "#1B7837"),
                decision = list(shape = "triangle", fillcolor = "#1B7837",
                                linecolor = "white"),
                utility = list(shape = "circle", fillcolor = "#762A83",
                               fontcolor = "white"))
plot(BlackJack)

HydePlotOptions(restorePackageDefaults = TRUE)

plot(BlackJack,
     customNodes = customNode(payoff,
                              fillcolor = "purple", shape = "circle",
                              fontcolor = "white", height = "2",
                              style="filled"))
plot(BlackJack,
  customNodes =
    dplyr::bind_rows(
      customNode(pointsAfterCard3,
                 shape = "circle",
                 style = "radial",
                 fillcolor = "#1B7837:#762A83",
                 fontcolor = "black",
                 height = "2"),
      customNode(playerFinalPoints,
                 shape = "circle",
                 style = "wedged",
                 height = "3",
                 fillcolor = c("red:orange:yellow:green:blue:purple"))))

## End(Not run)

Results