From the course: R: Interactive Visualizations with htmlwidgets
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Add legends to visNetwork - R Tutorial
From the course: R: Interactive Visualizations with htmlwidgets
Add legends to visNetwork
- [Instructor] VisNetwork allows us to fairly easily add legends to your network diagrams for the use of the group column in the node data frame let's see how to do that in our exercise files. Let's load visNetwork-legend.R. At the top of our script file, we load the tidyverse library, we Command + Enter. And then the visNetwork library, we Command + Enter. And then add data for the Games of Thrones universe that we're going to visualize comes from koggle.com, and also from shiring's blog. You can read about how I process this data in the data-raw folder if you're interested. But here, we simply import the nodes CSV files, and the edges CSV file. We then use mutate from dplyr to add a new column called group, and we provide group with the column superculture. So, now we're read to visualize our network. So let's type visNetwork GoT_nodes GoT_edges. Now if I were to display the network like this by pressing Command + Enter, we can see it take a couple of seconds to display the network…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
What is the visNetwork library?9m 57s
-
Create basic network diagrams7m 35s
-
Style visNetwork graph6m 27s
-
Use visNetwork with igraph5m 29s
-
Choose graph layouts and embeddings5m 5s
-
Cluster nodes in visNetwork using groups3m 56s
-
Add legends to visNetwork4m 51s
-
Extract click information from visNetwork8m 54s
-
-
-