From the course: R: Interactive Visualizations with htmlwidgets

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Style visNetwork graph

Style visNetwork graph - R Tutorial

From the course: R: Interactive Visualizations with htmlwidgets

Start my 1-month free trial

Style visNetwork graph

- [Instructor] Let's look at how we can customize the appearance of networks inside of visNetwork library. Inside of our Exercise Files we have a file called basic-visNetwork.R. Let's open that up and see what we have here. Again, to decrease the size of my environment because I don't need it for now. At the top of the script file we load the tidyverse library. So, that loads the standard libraries from the tidyverse ecosystem. Of course, because we're creating interactive visNetworks we'll load the visNetwork library as well. Then on line four and five we use read_csv to import our nodes and our edges data. And line eight through 12 we add a new ID column, which allows us to more easily refer to our nodes inside of the edges data frame. We also add a column called label, which will label our nodes when we zoom in on a visualization, and the title column which provides us a tooltip when we hover our cursor over the nodes. Lines 14 through 17 we're creating two new columns, from and…

Contents