Learn R Programming

visNetwork (version 0.1.2)

visOptions: Network visualization general options

Description

Network visualization general options. For full documentation, have a look at visDocumentation.

Usage

visOptions(graph, width = NULL, height = NULL, highlightNearest = FALSE,
  nodesIdSelection = FALSE, autoResize = NULL, clickToUse = NULL,
  manipulation = NULL, selectedBy = NULL)

Arguments

graph
: a visNetwork object
width
: String. Default to "100%". The width of the network in pixels or as a percentage.
height
: String. Default to "100%". The height of the network in pixels or as a percentage.
highlightNearest
: Custom Option. Just a Boolean, or a named list. Default to false. Highlight nearest when clicking a node ? This options use click event. Not available for DOT and Gephi.
  • "enabled"
{ : Boolean. Default to false. Activated or not ?.} <

item

  • nodesIdSelection
  • autoResize
  • clickToUse
  • manipulation
  • selectedBy

See Also

visNodes for nodes options, visEdges for edges options, visGroups for groups options, visLegend for adding legend, visOptions for custom option, visLayout & visHierarchicalLayout for layout, visPhysics for control physics, visInteraction for interaction, visDocumentation, visEvents, visConfigure ...

Examples

Run this code
# highlight nearest
nodes <- data.frame(id = 1:15, label = paste("Label", 1:15),
 group = sample(LETTERS[1:3], 15, replace = TRUE))

edges <- data.frame(from = trunc(runif(15)*(15-1))+1,
 to = trunc(runif(15)*(15-1))+1)

visNetwork(nodes, edges) %>% visOptions(highlightNearest = TRUE)
visNetwork(nodes, edges) %>% visOptions(highlightNearest = list(enabled = TRUE, degree = 2))

# with an id node selection
visNetwork(nodes, edges) %>%
 visOptions(highlightNearest = TRUE, nodesIdSelection = TRUE)

# or add a selection on another column
visNetwork(nodes, edges) %>%
 visOptions(selectedBy = "group")

nodes$sel <- sample(c("sel1", "sel2"), nrow(nodes), replace = TRUE)
visNetwork(nodes, edges) %>%
 visOptions(selectedBy = "sel")

Run the code above in your browser using DataLab