View source: R/specialEffects.R
effectFun | R Documentation |
Functions that can return appropriate graphic attributes (i.e. color interpolation) based on properties of the network (ages of edges,etc)
effectFun(name, ...)
effect.edgeAgeColor (net, onset, fade.dur,
start.color = "#000000FF", end.color = "#00000000",
na.color = "#CCCCCC55")
effect.vertexAgeColor (net, onset, fade.dur, start.color = "#000000FF",
end.color = "#00000000", na.color = "#CCCCCC55")
name |
the short name of the effect function to be returned. i.e |
... |
additional arguments to be passed in to effect functions |
net |
a network object to be evaluated |
onset |
the time at which the network should be evaluated |
fade.dur |
(effect property) numeric value giving the color duration of the interpolation |
start.color |
(effect property) color name for color value to be used at start of interpolation |
end.color |
(effect property) color name for color value to be used at start of interpolation |
na.color |
(effect property) default color name for color value to be used for edge/vertices that are not currently active |
The special effects functions can be called directly for use as graphic parameters with standard network plots, or via effectFun
which will return the effect in a functional form so that it can evaluated/substituted at each time point as plot control function to render.animation
effect.edgeAgeColor
calculates the edge of each edge in net
at the time onset
and uses the value to return a color interpolated between start.color
and end.color
by comparing the time of each edge to the fade.dur
parameter
effect.vertexAgeColor
does the same, but for vertices.
Users can also define functions to be called in this way
effectFun
returns the function named by its first argument, with any arguments matching in ... substituted.
skyebend@uw.edu
library(ndtv)
data('short.stergm.sim')
# render a plot with edges colored by age at time 24
# edges labeld with age
plot(short.stergm.sim,edge.col=effect.edgeAgeColor(short.stergm.sim,
fade.dur=25,
start.color = 'red',
end.color='blue',
onset=24),
edge.label=edges.age.at(short.stergm.sim,24),
edge.lwd=5)
## Not run:
# render an animation where edges are colored dynamically by their age
# starting out red and fading to blue
compute.animation(short.stergm.sim,slice.par = list(start=0,
end=25,
interval=1, a
ggregate.dur=5,
rule='latest'))
render.animation(short.stergm.sim,edge.col=effectFun('edgeAgeColor',
fade.dur=5,
start.color = 'red',
end.color='blue'))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.