vis_epicontacts {epicontacts} | R Documentation |
Plot epicontacts objects using visNetwork
Description
This function plots epicontacts
objects using the
visNetwork
package. The produced object is an htmlwidget
which
will need rendering within a web browser.
Usage
vis_epicontacts(
x,
thin = TRUE,
node_color = "id",
label = "id",
annot = TRUE,
node_shape = NULL,
shapes = NULL,
edge_label = NULL,
edge_color = NULL,
legend = TRUE,
legend_max = 10,
x_axis = NULL,
col_pal = cases_pal,
NA_col = "lightgrey",
edge_col_pal = edges_pal,
width = "90%",
height = "700px",
selector = TRUE,
editor = FALSE,
edge_width = 3,
...
)
Arguments
x |
An |
thin |
A logical indicating if the data should be thinned with |
node_color |
An index or character string indicating which field of the linelist should be used to color the nodes. |
label |
An index, logical, or character string indicating which fields
of the linelist should be used for labelling the nodes. Logical will be
recycled if necessary, so that the default |
annot |
An index, logical, or character string indicating which fields
of the linelist should be used for annotating the nodes. Logical will be
recycled if necessary, so that the default |
node_shape |
An index or character string indicating which field of the linelist should be used to determine the shapes of the nodes. |
shapes |
A named vector of characters indicating which icon code should
be used for each value |
edge_label |
An index or character string indicating which field of the contacts data should be used to label the edges of the graph. |
edge_color |
An index or character string indicating which field of the contacts data should be used to color the edges of the graph. |
legend |
A logical indicating whether a legend should be added to the plot. |
legend_max |
The maximum number of groups for a legend to be displayed. |
x_axis |
Feature currently only available in development "timeline" branch. |
col_pal |
A color palette for the nodes. |
NA_col |
The color used for unknown group. |
edge_col_pal |
A color palette for the edges. |
width |
The width of the output, in html compatible format (e.g. '90%' or '800px'). |
height |
The height of the output, in html compatible format (e.g. '800px'). |
selector |
A logical indicating if the selector tool should be used; defaults to TRUE. |
editor |
A logical indicating if the editor tool should be used; defaults to FALSE. |
edge_width |
An integer indicating the width of the edges. Defaults to 3. |
... |
Further arguments to be passed to |
Value
The same output as visNetwork
.
Author(s)
Thibaut Jombart (thibautjombart@gmail.com) VP Nagraj (vpnagraj@virginia.edu) Zhian N. Kamvar (zkamvar@gmail.com)
See Also
visNetwork
in the package visNetwork
.
edges_pal
and cases_pal
for color palettes used
Examples
if (require(outbreaks)) {
## example using MERS outbreak in Korea, 2014
head(mers_korea_2015[[1]])
head(mers_korea_2015[[2]])
x <- make_epicontacts(linelist=mers_korea_2015[[1]],
contacts = mers_korea_2015[[2]],
directed=TRUE)
## Not run:
plot(x)
plot(x, node_color = "place_infect")
# show transmission tree with time as the horizontal axis, showing all nodes
#' plot(x, node_color = "loc_hosp", legend_max=20, annot=TRUE)
#' plot(x, "place_infect", node_shape = "sex",
shapes = c(M = "male", F = "female"))
plot(x, "sex", node_shape = "sex", shapes = c(F = "female", M = "male"),
edge_label = "exposure", edge_color = "exposure")
## End(Not run)
}