Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

addFontAwesome

Use fontAwesome icons in visNetwork graph


Description

Add Font-Awesome for styling our graph with beautiful, professional icons. Please note that you'll already have these icons if using Shiny. Can also use addIonicons

Usage

addFontAwesome(graph, name = "font-awesome")

Arguments

graph

: a visNetwork object

name

: name of dependency

Value

graph htmlwidget with Font-Awesome dependencies attached.

Examples

# use fontAwesome icons using groups or nodes options 
# font-awesome is not part of dependencies. use addFontAwesome() if needed.
# https://fontawesome.com/v4.7.0/
# Version in package (and compatible with vis.js) : 4.7.0
# cheatsheet available in package: 
# system.file("fontAwesome/Font_Awesome_Cheatsheet.pdf", package = "visNetwork")

# definition in groups
nodes <- data.frame(id = 1:3, group = c("B", "A", "B"))
edges <- data.frame(from = c(1,2), to = c(2,3))

visNetwork(nodes, edges) %>%
  visGroups(groupname = "A", shape = "icon", icon = list(code = "f0c0", size = 75)) %>%
  visGroups(groupname = "B", shape = "icon", icon = list(code = "f007", color = "red")) %>%
  addFontAwesome()

# definition in nodes
nodes <- data.frame(id = 1:3, shape = "icon", icon.face = 'FontAwesome', 
   icon.code = "f0c0")
edges <- data.frame(from = c(1,2), to = c(1,3))

visNetwork(nodes, edges) %>%
  addFontAwesome()

# using shinydashboard : change name if needed
visNetwork(nodes, edges) %>%
  addFontAwesome(name = "font-awesome-visNetwork")

visNetwork

Network Visualization using 'vis.js' Library

v2.0.9
MIT + file LICENSE
Authors
Almende B.V. [aut, cph] (vis.js library in htmlwidgets/lib, http://visjs.org, http://www.almende.com/home), Benoit Thieurmel [aut, cre] (R interface), Titouan Robert [aut, ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.