Description Usage Arguments Details Author(s) Source Examples
View source: R/plot.HydeNetwork.R
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
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## S3 method for class 'HydeNetwork'
plot(
x,
customNodes = NULL,
customEdges = NULL,
...,
removeDeterm = FALSE,
useHydeDefaults = TRUE
)
mergeCustomNodes(node_df, customNodes)
mapEdges(n, p, node_df)
mergeCustomEdges(edge_df, customEdges)
customNode(node_id, ...)
HydePlotOptions(
variable = NULL,
determ = NULL,
decision = NULL,
utility = NULL,
restorePackageDefaults = FALSE
)
|
x |
an object of class |
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 |
removeDeterm |
A logical value. When |
useHydeDefaults |
A logical value indicating if the default plot
parameters in |
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 |
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. |
GraphViz is an enormous set of resources for customizing and we
cannot adequately describe them all here. See 'Sources' for links
to additional documentation from the DiagrammeR
package and the
GraphViz website.
With its default settings, HydeNet
makes use of five node
attributes for plotting networks. These are
style: By default, set to 'filled', but may also take 'striped', 'wedged', or 'radial'.
fillcolor: The hexadecimal or X11 color name. In styles 'striped', 'wedged', or 'radial', this may take multiple colors separated by a colon (:).
shape: the node shape. May take the values 'oval', 'diamond', 'egg', 'ellipse', 'square', 'triangle', or 'rect'
fontcolor: The color of the node label.
color: The color of the node's border.
HydeNet
assumes the GraphViz defaults for edge nodes (arrows).
See the Plotting Hyde Networks vignette (vignette("HydeNetPlots")
)
for a more thorough explanation of plotting networks.
Jarrod Dalton and Benjamin Nutter
http://rich-iannone.github.io/DiagrammeR/graphviz_and_mermaid.html
See especially the section on Attributes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ## 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)
|
Loading required package: nnet
Warning message:
In file(con, "rb") : cannot open file '/etc/timezone': Permission denied
Warning message:
In file(con, "rb") : cannot open file '/etc/timezone': Permission denied
Warning message:
In file(con, "rb") : cannot open file '/etc/timezone': Permission denied
Warning message:
In file(con, "rb") : cannot open file '/etc/timezone': Permission denied
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.