Plot an ENA network: nodes and edges

ena.plot.network(
  enaplot = NULL,
  network = NULL,
  node.positions = enaplot$enaset$rotation$nodes,
  adjacency.key = NULL,
  colors = c(pos = enaplot$palette[1], enaplot$palette[2]),
  edge_type = "line",
  show.all.nodes = T,
  threshold = c(0),
  thin.lines.in.front = T,
  thickness = c(min(abs(network)), max(abs(network))),
  opacity = thickness,
  saturation = thickness,
  scale.range = c(ifelse(min(network) == 0, 0, 0.1), 1),
  node.size = c(3, 10),
  labels = NULL,
  label.offset = "middle right",
  label.font.size = enaplot$get("font.size"),
  label.font.color = enaplot$get("font.color"),
  label.font.family = enaplot$get("font.family"),
  legend.name = NULL,
  legend.include.edges = F,
  scale.weights = T,
  ...
)

Arguments

enaplot

ENAplot object to use for plotting

network

dataframe or matrix containing the edge weights for the network graph; typically comes from ENAset$line.weights

node.positions

matrix containing the positiions of the nodes. Defaults to enaplot$enaset$node.positions

adjacency.key

matrix containing the adjacency key for looking up the names and positions

colors

A String or vector of colors for positive and negative line weights. E.g. red or c(pos= red, neg = blue), default: c(pos= red, neg = blue)

edge_type

A String representing the type of line to draw, either "line", "dash", or "dot"

show.all.nodes

A Logical variable, default: true

threshold

A vector of numeric min/max values, default: c(0,Inf) plotting . Edge weights below the min value will not be displayed; edge weights above the max value will be shown at the max value.

thin.lines.in.front

A logical, default: true

thickness

A vector of numeric min/max values for thickness, default: c(min(abs(network)), max(abs(network)))

opacity

A vector of numeric min/max values for opacity, default: thickness

saturation

A vector of numeric min/max values for saturation, default: thickness

scale.range

A vector of numeric min/max to scale from, default: c(0.1,1) or if min(network) is 0, c(0,1)

node.size

A lower and upper bound used for scaling the size of the nodes, default c(0, 20)

labels

A character vector of node labels, default: code names

label.offset

A character vector of representing the positional offset relative to the respective node. Defaults to "middle right" for all nodes. If a single values is provided, it is used for all positions, else the length of the

label.font.size

An integer which determines the font size for graph labels, default: enaplot$font.size

label.font.color

A character which determines the color of label font, default: enaplot$font.color

label.font.family

A character which determines font type, choices: Arial, Courier New, Times New Roman, default: enaplot$font.family

legend.name

A character name used in the plot legend. Not included in legend when NULL (Default), if legend.include.edges is TRUE will always be "Nodes"

legend.include.edges

Logical value indicating if the edge names should be included in the plot legend. Forces legend.name to be "Nodes"

scale.weights

Logical indicating to scale the supplied network

...

Additional parameters

Value

The ENAplot provided to the function, with its plot updated to include the nodes and provided connecting lines.

Details

lots a network graph, including nodes (taken from codes in the ENAplot) and the edges (provided in network)

See also

Examples

data(RS.data) codeNames = c('Data','Technical.Constraints','Performance.Parameters', 'Client.and.Consultant.Requests','Design.Reasoning','Collaboration'); accum = ena.accumulate.data( units = RS.data[,c("UserName","Condition")], conversation = RS.data[,c("Condition","GroupName")], metadata = RS.data[,c("CONFIDENCE.Change","CONFIDENCE.Pre","CONFIDENCE.Post")], codes = RS.data[,codeNames], window.size.back = 4 ) set = ena.make.set( enadata = accum, rotation.by = ena.rotate.by.mean, rotation.params = list( accum$meta.data$Condition=="FirstGame", accum$meta.data$Condition=="SecondGame" ) ) plot = ena.plot(set) ### Subset rotated points and plot Condition 1 Group Mean as.matrix(set$points$Condition$FirstGame)
#> MR1 SVD2 SVD3 SVD4 SVD5 #> [1,] -0.056054354 -0.008605342 -0.002057220 0.017117506 -0.0203390545 #> [2,] -0.086342146 0.001037475 0.041189098 0.009581292 0.0218257846 #> [3,] -0.287738174 -0.174169929 -0.041421698 0.056217164 0.0239272758 #> [4,] 0.024420908 -0.103194928 0.096641376 -0.012314776 -0.0006745635 #> [5,] -0.188438766 0.056262827 -0.047768406 0.383830896 -0.0363806633 #> [6,] -0.126092030 -0.130759463 -0.212558839 -0.125681709 0.0512785901 #> [7,] -0.289888189 -0.002927022 0.140070754 0.151983997 0.0313885290 #> [8,] -0.095113420 -0.171095254 0.116333000 -0.029705018 -0.0307697997 #> [9,] -0.078778008 -0.241402399 -0.086243251 0.073103528 -0.1104595345 #> [10,] -0.031637314 -0.080885967 -0.022172479 -0.090013939 -0.0052698757 #> [11,] -0.005792158 0.255963362 0.064764006 -0.096544323 -0.0340864744 #> [12,] -0.033157252 -0.004428193 -0.060324536 0.020110024 -0.0076613570 #> [13,] -0.045707804 -0.045938053 0.019112460 -0.032890108 0.0877277105 #> [14,] -0.210835345 -0.146089807 0.065982843 -0.023150102 -0.0748037814 #> [15,] -0.023089038 -0.129914011 0.115071931 0.027063686 -0.0011689788 #> [16,] -0.131481029 0.119449677 0.081580689 -0.056070583 -0.0983348835 #> [17,] -0.152712520 0.020832482 0.021940497 -0.074535892 -0.0597139160 #> [18,] -0.071251835 0.215270364 0.130413272 -0.065057713 -0.1040979421 #> [19,] 0.021839319 0.114224081 0.152473241 -0.026299413 -0.0583263509 #> [20,] -0.309228076 0.130713802 -0.067751916 0.049044923 0.1491375818 #> [21,] -0.100523852 0.232730878 -0.177822012 -0.011542405 0.1147132802 #> [22,] 0.009957384 0.061352461 0.012788398 -0.024841008 -0.0452206489 #> [23,] -0.093626205 -0.014042897 -0.077724151 0.042322679 0.1010558289 #> [24,] 0.225153276 -0.021650931 0.015335147 -0.053937243 0.0992517693 #> [25,] -0.057735437 -0.025849362 -0.286110111 -0.102257318 -0.0590119060 #> [26,] -0.111499312 0.093116147 0.008257909 -0.005534144 0.0660133800 #> SVD6 SVD7 SVD8 SVD9 SVD10 #> [1,] 0.026473339 -0.01418133 0.0446203078 0.004158459 0.001599785 #> [2,] 0.016909015 0.01903734 0.0219230429 0.021131058 0.005993553 #> [3,] 0.024446792 0.07086400 -0.0865961044 0.058080615 0.078922007 #> [4,] 0.032983949 0.01382008 0.0429484829 0.014347079 0.037697169 #> [5,] 0.066514754 0.02374807 -0.0335953997 -0.028085061 -0.038439286 #> [6,] 0.032647410 -0.03627855 0.0560217550 -0.010315327 -0.037461894 #> [7,] 0.057386995 -0.05371739 -0.0348714352 0.024212619 -0.072028391 #> [8,] 0.019414590 -0.04165053 -0.0535319360 0.031313127 -0.059308351 #> [9,] -0.054200971 -0.02120410 -0.0189808899 -0.034506525 -0.012688944 #> [10,] 0.073912309 0.01852309 -0.0220682097 0.015731392 0.021506544 #> [11,] 0.031886360 -0.06743132 -0.1461054941 -0.029742948 0.010559781 #> [12,] 0.076018187 -0.05614734 0.0470371016 -0.055985261 0.029970908 #> [13,] -0.056488056 0.04311472 -0.0143950164 -0.092245667 0.003529600 #> [14,] 0.001713129 -0.03943270 -0.0120372523 0.078821541 0.022180980 #> [15,] 0.002358982 -0.03724749 0.0603176369 -0.025647167 0.012739354 #> [16,] -0.037336256 0.02370408 0.0171656240 -0.001480756 0.001092940 #> [17,] -0.014694599 0.02529245 -0.0077706756 0.040244764 -0.008351668 #> [18,] 0.036408749 0.05216560 0.0596062852 -0.007566808 -0.010002211 #> [19,] -0.102146290 0.05399016 0.0277466193 0.021041801 -0.022146577 #> [20,] 0.091463229 0.04959516 0.0287856791 -0.002448404 0.016340298 #> [21,] -0.085731460 0.03300727 -0.0029974743 0.007837150 -0.049008784 #> [22,] -0.059318827 0.02550921 -0.0061038551 -0.050688122 0.017338949 #> [23,] -0.078379200 -0.04130277 0.0047171079 -0.045545964 0.028277576 #> [24,] -0.056151015 -0.02536253 0.0044716553 -0.022229562 -0.029548696 #> [25,] -0.048481636 -0.04540053 0.0006631165 0.068592962 -0.007967886 #> [26,] 0.002390519 0.02698535 0.0230293282 0.020975007 0.059203242 #> SVD11 SVD12 SVD13 SVD14 SVD15 #> [1,] -0.0333050931 0.0165531102 -0.028407376 -0.0207585395 -0.0053940834 #> [2,] -0.0170799780 0.0021253735 0.003675627 -0.0384961876 0.0192281844 #> [3,] -0.0030538098 0.0248114175 0.012251274 0.0119520417 0.0005867374 #> [4,] 0.0019388083 -0.0081469163 0.003851633 -0.0177917107 0.0339347502 #> [5,] 0.0197731980 -0.0247574647 0.035928355 0.0197203401 0.0077399055 #> [6,] -0.0106412043 -0.0088460398 0.029994762 0.0360981220 -0.0072604839 #> [7,] 0.0220803566 0.0079019261 -0.045897460 0.0008759494 0.0034387254 #> [8,] 0.0026321959 -0.0154785444 0.004122053 -0.0237043329 -0.0175786585 #> [9,] -0.0032025067 0.0389154118 -0.028690731 0.0097518202 0.0023686922 #> [10,] 0.0125678074 -0.0109990771 -0.034430729 -0.0296371494 -0.0050268196 #> [11,] -0.0467796141 0.0049980959 0.018937747 0.0018080087 0.0160082236 #> [12,] 0.0117279808 0.0003613296 -0.010760152 -0.0025512634 -0.0146651267 #> [13,] 0.0242405859 -0.0063406600 0.011004721 -0.0251377255 -0.0076106903 #> [14,] -0.0029113676 -0.0158476350 0.008696809 0.0274733083 -0.0294934257 #> [15,] 0.0208804789 -0.0159003367 0.010401085 0.0061143636 -0.0007946175 #> [16,] 0.0156366006 0.0181741955 -0.018578534 0.0050545803 -0.0095301942 #> [17,] 0.0181960061 -0.0167989228 0.013095506 -0.0242238520 0.0070807421 #> [18,] 0.0329114271 0.0200175050 0.002407689 0.0188802015 0.0167367876 #> [19,] -0.0101168118 -0.0001986431 0.015411400 -0.0013401098 -0.0013820590 #> [20,] -0.0325956909 0.0416778436 0.017225157 0.0413605789 -0.0149241355 #> [21,] -0.0029084046 -0.0264566957 -0.008872722 0.0136909042 -0.0057384467 #> [22,] 0.0001017664 -0.0003453221 0.017570113 -0.0197139186 -0.0122833820 #> [23,] -0.0092083091 -0.0002797472 0.007524841 -0.0115362527 0.0230667521 #> [24,] -0.0033734638 -0.0449990245 -0.022922844 0.0112421701 -0.0189097280 #> [25,] 0.0067597533 -0.0160706174 0.004087811 0.0192295118 0.0382657612 #> [26,] -0.0142707117 0.0359294379 -0.017626035 -0.0083608588 -0.0178634108
first.game.points = as.matrix(set$points$Condition$FirstGame) plot = ena.plot.group(plot, first.game.points, labels = "FirstGame", colors = "red", confidence.interval = "box") ### Subset rotated points and plot Condition 2 Group Mean second.game.points = as.matrix(set$points$Condition$SecondGame) plot = ena.plot.group(plot, second.game.points, labels = "SecondGame", colors = "blue", confidence.interval = "box") ### get mean network plots first.game.lineweights = as.matrix(set$line.weights$Condition$FirstGame) first.game.mean = colMeans(first.game.lineweights) second.game.lineweights = as.matrix(set$line.weights$Condition$SecondGame) second.game.mean = colMeans(second.game.lineweights) subtracted.network = first.game.mean - second.game.mean plot = ena.plot.network(plot, network = subtracted.network) print(plot)