This function creates a 3D graph from an epicontacts object

graph3D(x, group = "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)

Arguments

x

An epicontacts object

group

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 'group' (if the grouping column is different from 'id').

col_pal

A color palette for the groups.

NA_col

The color used for unknown group.

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.

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.)

Note

All colors must be specified as color names like "red", "blue", etc. or as hexadecimal color values without opacity channel, for example "#FF0000", "#0a3e55" (upper or lower case hex digits are allowed).

Double-click or tap on the plot to reset the view.

References

Original three.js code by David Piegza: https://github.com/davidpiegza/Graph-Visualization.

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

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$linelist, contacts = mers_korea_2015$contacts, directed = FALSE) ## Not run: ------------------------------------ # graph3D(x) # graph3D(x, annot = FALSE) # graph3D(x, group = "sex", g_title = "MERS Korea 2014") # graph3D(x, group = "sex", annot = c("sex", "age"), # g_title = "MERS Korea 2014") ## --------------------------------------------- }