effectFun: functions to manipulate graphic attributes of network for...

View source: R/specialEffects.R

effectFunR Documentation

functions to manipulate graphic attributes of network for 'special effects'

Description

Functions that can return appropriate graphic attributes (i.e. color interpolation) based on properties of the network (ages of edges,etc)

Usage

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")

Arguments

name

the short name of the effect function to be returned. i.e 'edgeAgeColor' will return the effect.edgeAgeColor function

...

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

Details

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

Value

effectFun returns the function named by its first argument, with any arguments matching in ... substituted.

Author(s)

skyebend@uw.edu

Examples

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)     


ndtv documentation built on July 4, 2024, 5:08 p.m.