Learn R Programming

visNetwork (version 0.1.1)

visNodes: Network visualization nodes options

Description

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

Usage

visNodes(graph, id = NULL, shape = NULL, size = NULL, title = NULL,
  value = NULL, x = NULL, y = NULL, label = NULL, level = NULL,
  group = NULL, hidden = NULL, image = NULL, mass = NULL,
  physics = NULL, borderWidth = NULL, borderWidthSelected = NULL,
  brokenImage = NULL, labelHighlightBold = NULL, color = NULL,
  fixed = NULL, font = NULL, icon = NULL, shadow = NULL,
  scaling = NULL, shapeProperties = NULL)

Arguments

graph
: a visNetwork object
id
: String. Default to undefined. The id of the node. The id is mandatory for nodes and they have to be unique. This should obviously be set per node, not globally.
shape
: String. Default to 'ellipse'. The shape defines what the node looks like. There are two types of nodes. One type has the label inside of it and the other type has the label underneath it. The types with the label inside of it are: ellipse, circle, datab
size
: Number. Default to 25. The size is used to determine the size of node shapes that do not have the label inside of them. These shapes are: image, circularImage, diamond, dot, star, triangle, triangleDown, square and icon
title
: String or Element. Default to undefined. Title to be displayed when the user hovers over the node. The title can be an HTML element or a string containing plain text or HTML.
value
: Number. Default to undefined. When a value is set, the nodes will be scaled using the options in the scaling object defined above.
x
: Number. Default to undefined. This gives a node an initial x position. When using the hierarchical layout, either the x or y position is set by the layout engine depending on the type of view. The other value remains untouched. When using stabilization,
y
: Number. Default to undefined. This gives a node an initial y position. When using the hierarchical layout, either the x or y position is set by the layout engine depending on the type of view. The other value remains untouched. When using stabilization,
label
: String. Default to undefined. The label is the piece of text shown in or under the node, depending on the shape.
level
: Number. Default to undefined. When using the hierarchical layout, the level determines where the node is going to be positioned.
group
: String. Default to undefined. When not undefined, the group of node(s)
hidden
: Boolean. Default to false. When true, the node will not be shown. It will still be part of the physics simulation though!
image
: String. Default to undefined. When the shape is set to image or circularImage, this option should be the URL to an image. If the image cannot be found, the brokenImage option can be used.
mass
: Number. Default to 1. The barnesHut physics model (which is enabled by default) is based on an inverted gravity model. By increasing the mass of a node, you increase it's repulsion. Values lower than 1 are not recommended.
physics
: Boolean. Default to true. When false, the node is not part of the physics simulation. It will not move except for from manual dragging.
borderWidth
: Number. Default to 1. The width of the border of the node when it is not selected, automatically limited by the width of the node.
borderWidthSelected
: Number. Undefined. The width of the border of the node when it is selected. If left at undefined, double the borderWidth will be used.
brokenImage
: String. Undefined. When the shape is set to image or circularImage, this option can be an URL to a backup image in case the URL supplied in the image option cannot be resolved
labelHighlightBold
: Boolean. Default to true. Determines whether or not the label becomes bold when the node is selected.
color
: String | named list. Color for the node. Can be just one color, or a list with several elements :
  • "background"
{ : String. Default to '#97C2FC'. Background color for the node.} "border"{ : String. Default to '#2B7CE9'
"hover"
: named list, when the hover option is enabled
  • "background"
{ : String. Default to '#2B7CE9'. Border color of the node when selected.} "border"{ : String. Default to '#2B7CE9'. Border color of the node when the node

item

  • fixed
  • "y"
  • font
  • "size"
  • "face"
  • "background"
  • "strokeWidth"
  • "strokeColor"
  • icon
  • "code"
  • "size"
  • "color"
  • shadow
  • "size"
  • "x"
  • "y"
  • scaling
  • "max"
  • "label"
  • "min"
  • "max"
  • "maxVisible"
  • "drawThreshold"
  • "customScalingFunction"
  • shapeProperties
  • "borderRadius"
  • "useImageSize"

itemize

  • "borderDashes"

See Also

visNodes for nodes options, visEdges for edges options, visGroups for groups options, visLayout & visHierarchicalLayout for layout, visPhysics for physics, visInteraction for interaction, ...

Examples

Run this code
nodes <- data.frame(id = 1:3)
edges <- data.frame(from = c(1,2), to = c(1,3))

visNetwork(nodes, edges) %>% visNodes(shape = "square", title = "I'm a node", borderWidth = 3)

visNetwork(nodes, edges) %>% visNodes(color = list(hover = "green")) %>%
 visInteraction(hover = TRUE)

visNetwork(nodes, edges) %>% visNodes(color = "red")

visNetwork(nodes, edges) %>% visNodes(color = list(background = "red", border = "blue",
 highlight = "yellow"))

visNetwork(nodes, edges) %>% visNodes(shadow = TRUE)

visNetwork(nodes, edges) %>% visNodes(shadow = list(enabled = TRUE, size = 50))

Run the code above in your browser using DataLab