nlevels
by nlevels
matrix indicating the
number of individuals that lie within each cell, and draws a heatmap.
plot_infectsuscep(graph, toa, t0 = NULL, normalize = TRUE, K = 1L, r = 0.5, expdiscount = FALSE, bins = 20, nlevels = round(bins/2), h = NULL, logscale = TRUE, main = "Distribution of Infectiousness and\nSusceptibility", xlab = "Infectiousness of ego", ylab = "Susceptibility of ego", sub = ifelse(logscale, "(in log-scale)", NA), color.palette = grDevices::colorRampPalette(grDevices::blues9), include.grid = TRUE, exclude.zeros = FALSE, valued = getOption("diffnet.valued", FALSE), ...)
netdiffuseR-graphs
).toa_mat
.filled.contour
).kde2d
in the MASS package.filled.contour
).logscale=TRUE
.filled.contour.
By default the function will try to apply a kernel smooth function via
kde2d
. If not possible (because not enought data points), then
the user should try changing the parameter h
or set it equal to zero.
toa
is passed to infection/susceptibility
.
infection
and
susceptibility
.Other visualizations: dgr
,
diffusionMap
, drawColorKey
,
grid_distribution
,
hazard_rate
, plot_adopters
,
plot_diffnet2
, plot_diffnet
,
plot_threshold
,
rescale_vertex_igraph
# Generating a random graph -------------------------------------------------
set.seed(1234)
n <- 100
nper <- 20
graph <- rgraph_er(n,nper, p=.2, undirected = FALSE)
toa <- sample(1:(1+nper-1), n, TRUE)
# Visualizing distribution of suscep/infect
out <- plot_infectsuscep(graph, toa, K=3, logscale = FALSE)
Run the code above in your browser using DataLab