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

Description Usage Arguments Value Note Author(s) References Examples

View source: R/graph3D.R

Description

This function creates a 3D graph from an epicontacts object

Usage

1
2
3
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)

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.

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.

Author(s)

Nistara Randhawa ([email protected]) Thibaut Jombart ([email protected]) VP Nagraj ([email protected])

References

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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, node_color = "sex", g_title = "MERS Korea 2014")
graph3D(x, node_color = "sex", annot = c("sex", "age"),
        g_title = "MERS Korea 2014")

## End(Not run)
}

Example output

Loading required package: outbreaks

epicontacts documentation built on May 2, 2019, 11:29 a.m.