Learn R Programming

netdiffuseR (version 1.16.2)

plot_threshold: Threshold levels through time

Description

Draws a graph where the coordinates are given by time of adoption, x-axis, and threshold level, y-axis.

Usage

plot_threshold(graph, expo, toa, t0 = min(toa, na.rm = TRUE),
  undirected = getOption("diffnet.undirected"), no.contemporary = TRUE,
  main = "Time of Adoption by Network Threshold", xlab = "Time",
  ylab = "Threshold", vertex.cex = "degree", vertex.col = "blue",
  vertex.label = NULL, vertex.lab.pos = 3, edge.width = 2,
  edge.col = "gray", arrow.length = 0.2, include.grid = TRUE, bty = "n",
  ...)

Arguments

graph
A dynamic graph (see netdiffuseR-graphs).
expo
$n\times T$ matrix. Esposure to the innovation obtained from exposure
toa
Integer vector of size $n$. Times of Adoption
t0
Integer scalar. Passed to threshold.
undirected
Logical scalar.
no.contemporary
Logical scalar. When TRUE, edges for vertices with the same toa won't be plotted.
main
Character scalar. Title of the plot.
xlab
Character scalar. x-axis label.
ylab
Character scalar. y-axis label.
vertex.cex
Numeric vector of size $n$. Relative size of the vertices.
vertex.col
Either a vector of size $n$ or a scalar indicating colors of the vertices.
vertex.label
Character vector of size $n$. Labels of the vertices.
vertex.lab.pos
Integer value to be passed to text via pos.
edge.width
Numeric. Width of the edges.
edge.col
Character. Color of the edges.
arrow.length
Numeric value to be passed to arrows.
include.grid
Logical. When TRUE, the grid of the graph is drawn.
bty
See par.
...
Additional arguments passed to plot.

See Also

Use threshold to retrieve the corresponding threshold obtained returned by exposure.

Other visualizations: hazard_rate, plot_adopters, plot_diffnet, plot_infectsuscep

Examples

Run this code
# Generating a random graph
set.seed(1234)
n <- 6
nper <- 5
graph <- rgraph_er(n,nper, p=.3, undirected = FALSE)
toa <- sample(2000:(2000+nper-1), n, TRUE)
adopt <- toa_mat(toa)

# Computing exposure
expos <- exposure(graph, adopt$cumadopt)

plot_threshold(graph, expos, toa)

# Calculating degree (for sizing the vertices)
plot_threshold(graph, expos, toa, vertex.cex = "indegree")

Run the code above in your browser using DataLab