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

Add legends to visNetwork - R Tutorial

From the course: R: Interactive Visualizations with htmlwidgets

Start my 1-month free trial

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…

Contents