Learn R Programming

netdiffuseR (version 1.16.7)

plot_diffnet2: Another way of visualizing diffusion

Description

Another way of visualizing diffusion

Usage

plot_diffnet2(graph, ...)
"plot_diffnet2"(graph, toa = NULL, slice = nslices(graph), color.ramp = grDevices::colorRamp(c("skyblue", "yellow", "red")), layout = NULL, key.width = 0.1, key.title = "Time of Adoption", main = "Diffusion dynamics", vertex.size = NULL, vertex.shape = NULL, vertex.label = "", vertex.frame.color = "gray", edge.arrow.size = 0.5, edge.curved = FALSE, add.map = NULL, diffmap.args = list(kde2d.args = list(n = 100)), diffmap.alpha = 0.5, include.white = "first", rescale.fun = rescale_vertex_igraph, ...)
"plot_diffnet2"(graph, toa, pers = min(toa, na.rm = TRUE):max(toa, na.rm = TRUE), color.ramp = grDevices::colorRamp(c("skyblue", "yellow", "red")), layout = NULL, key.width = 0.1, key.title = "Time of\nAdoption", main = "Diffusion dynamics", vertex.size = NULL, vertex.shape = NULL, vertex.label = "", vertex.frame.color = "gray", edge.arrow.size = 0.5, edge.curved = FALSE, add.map = NULL, diffmap.args = list(kde2d.args = list(n = 100)), diffmap.alpha = 0.5, include.white = "first", rescale.fun = rescale_vertex_igraph, ...)

Arguments

graph
Either a square matrix or a diffnet object.
...
Further arguments passed to plot.igraph.
toa
Integer vector of length $n$ with the times of adoption.
slice
Integer scalar. Number of slice to use as baseline for drawing the graph.
color.ramp
A function as returned by colorRamp.
layout
Passed to plot.igraph.
key.width
Numeric scalar. Sets the proportion of the plot (x-axis) that the key uses.
key.title
Character scalar. Title of the key (vertex colors).
main
Character scalar. Title of the graph.
vertex.size
Passed to plot.igraph.
vertex.shape
Passed to plot.igraph.
vertex.label
Passed to plot.igraph.
vertex.frame.color
Passed to plot.igraph.
edge.arrow.size
Passed to plot.igraph.
edge.curved
Passed to plot.igraph.
add.map
Character scalar. When "first" plots a diffusionMap before the graph itself. If "last" then it adds it at the end. When NULL adds nothing.
diffmap.args
List. If add.map=TRUE, arguments passed to diffusionMap.
diffmap.alpha
Numeric scalar between [0,1]. Alpha level for the map.
include.white
Character scalar. Includes white in the color palette used in the map. When include.white=NULL then it won't include it.
rescale.fun
A function to rescale vertex size. By defult it is set to be rescale_vertex_igraph
pers
Integer vector of length $T$ indicating the time periods of the data.

Value

A list with the following elements
layout
A numeric matrix with vertex coordinates.
vertex.color
A character vector with computed colors for each vertex.
vertex.label
The value passed to plot_diffnet2.
vertex.shape
A character vector with assigned shapes.
vertex.size
A numeric vector with vertices sizes
diffmap
If add.map=TRUE, the returned values from diffmap

Details

If key.width<=0< code=""> then no key is created.

See Also

Other visualizations: diffusionMap, drawColorKey, hazard_rate, plot_adopters, plot_diffnet, plot_infectsuscep, plot_threshold, rescale_vertex_igraph