NetworkNodeSetColor {RNetica} | R Documentation |
Returns the display colour associated with a node set or sets the node
set colour to a specified value. The colour of the node in the Netica
GUI will be the colour of the highest priority node set associated with
the node (see NetworkSetPriority()
.
NetworkNodeSetColor(net, setname, newcolor)
net |
An active |
setname |
A character scalar giving the name of the node set to be coloured. |
newcolor |
An optional scalar of any of the three kind of R colours, i.e., either a
colour name (an element of |
Netica determines the visual style of a node by stepping through the
node sets to which the node belongs in priority order (see
NetworkSetPriority()
) . Each node set
can either have a colour set, or a flag set to indicate that the next
node in order or priority should be used to determine the appearance
of the node. The expression NetworkNodeSetColor(net,setname,NA)
sets the flag so that membership in setname
does not affect the
display of the node.
The function
NetworkNodeSetColor(net,setname,colour)
sets
the colour associated with the visual display of these nodes (this is
only visible when the network is open in the Netica GUI). The colour
can be specified in any of the usual ways that colours are specified
in R (see col2rgb()
). The special value
NA
is used to indicate that the set should be
‘transparent’, that is the colour of the next set in priority
should be used to colour the node.
The function NetworkNodeSetColor(net,setname)
, with
the third argument missing, returns the current node set colour instead of
setting it.
The old value of the node colour as hexadecimal string value of the
form "#rrggbb"
.
The colors of the built-in Netica node sets serve as the ultimate default for the display of nodes. These cannot be set or queried through this function. (This is a limitation of the Netica API).
Russell Almond
http://norsys.com/onLurl/Manual/index.html: ReorderNodesets_bn(), SetNodesetColor_bn()
NeticaNode
, NodeSets()
,
NetworkNodeSets()
, col2rgb()
,
rgb()
,
NetworkNodesInSet()
, NetworkSetPriority()
sess <- NeticaSession() startSession(sess) nsnet <- CreateNetwork("NodeSetExample", session=sess) Ability <- NewContinuousNode(nsnet,"Ability") X1 <- NewDiscreteNode(nsnet,"Item1",c("Right","Wrong")) EssayScore <- NewDiscreteNode(nsnet,"EssayScore",paste("level",5:0,sep="_")) Value <- NewContinuousNode(nsnet,"Value") NodeKind(Value) <- "Utility" Placement <- NewDiscreteNode(nsnet,"Placement", c("Advanced","Regular","Remedial")) NodeKind(Placement) <- "Decision" NodeSets(Ability) <- "ReportingVariable" NodeSets(X1) <- "Observable" NodeSets(EssayScore) <- c("ReportingVariable","Observable") ## Default colour is NA (transparent) stopifnot( is.na(NetworkNodeSetColor(nsnet,"Observable")) ) ## Make Reporting variables a pale blue NetworkNodeSetColor(nsnet,"ReportingVariable",rgb(1,.4,.4)) stopifnot( NetworkNodeSetColor(nsnet,"ReportingVariable") == "#ff6666" ) ## Using R (nee X11) color list. NetworkNodeSetColor(nsnet,"Observable","wheat2") stopifnot( NetworkNodeSetColor(nsnet,"ReportingVariable") == "#ff6666" ) DeleteNetwork(nsnet) stopSession(sess)