Learn R Programming

epicontacts (version 1.1.4)

graph3D: Interactive 3D Force-directed graph from epicontacts object

Description

This function creates a 3D graph from an epicontacts object

Usage

graph3D(
  x,
  node_color = "id",
  annot = TRUE,
  col_pal = cases_pal,
  NA_col = "lightgrey",
  g_title = "",
  bg_col = "white",
  label_col = "darkgrey",
  node_size = 1,
  edge_size = 0.5
)

Value

An htmlwidget object that is displayed using the object's show or print method. (If you don't see your widget plot, try printing it with the print function.)

Arguments

x

An epicontacts object

node_color

An index or character string indicating which field of the linelist should be used to color the nodes. Default is id

annot

An index, logical, or character string indicating which fields of the linelist should be used for annotating the nodes upon mouseover. The default TRUE shows the 'id' and 'node_color' (if the grouping column is different from 'id').

col_pal

A color palette for the node_colors.

NA_col

The color used for unknown node_color.

g_title

The title of the graph.

bg_col

The background color of graph.

label_col

The color of the graph title and labels of groups.

node_size

The sizes of graph nodes.

edge_size

The width of graph edges.

Author

Nistara Randhawa (nrandhawa@ucdavis.edu) Thibaut Jombart (thibautjombart@gmail.com) VP Nagraj (vpnagraj@virginia.edu)

References

Original rthreejs code by B. W. Lewis: https://github.com/bwlewis/rthreejs.

Examples

Run this code
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$linelist,
                      contacts = mers_korea_2015$contacts,
                      directed = FALSE)

if (FALSE) {
graph3D(x)
graph3D(x, annot = FALSE)
graph3D(x, node_color = "sex", g_title = "MERS Korea 2014")
graph3D(x, node_color = "sex", annot = c("sex", "age"),
        g_title = "MERS Korea 2014")
}
}

Run the code above in your browser using DataLab