R/plot_network.R

Defines functions plot_network

Documented in plot_network

#' Plot events and names in the Norway Digital Archives
#'
#' Plot events and names using a force directed network graphic
#'
#' A wrapper for `code{forceNetwork}` with some basic defaults.
#'
#' @param net A list with nodes and links from \code{\link{create_network}}
#'
#' @return A network graph
#'
#' @author Chris Stubben
#'
#' @examples
#' \dontrun{
#'   s1 <- advanced_search(1638, first="Siv*", last="Lars*", residence="Stub*")
#'   sivert <- get_records(s1)
#'   net <- create_network(sivert, highlight="Stub")
#'   plot_network(net)
#' }
#' @export
plot_network <- function(net, ... ){
  networkD3::forceNetwork(net$Links, net$Nodes, Source = "source",
               Target = "target", Value="value", NodeID = "name", linkDistance=30,
               Group = "group", ...)
}
cstubben/norwayr documentation built on May 14, 2019, 12:25 p.m.