1. Alternative visualizations
Up until now we have been using a very common method of visualizing graphs, plotting them as what are sometimes known as "hairball plots". Generally these are plotted with a variety of algorithms designed to maximize the spacing between vertices. However as soon as the graphs grow to even a modest number of vertices the plots become uninterpretable. Other methods of visualization have been developed to try and convey a greater amount of information even as graph size grows. In this lesson we'll introduce two alternatives, hive plots and biofabric plots.
2. Introduction to hive plots
Hive plots are a great alternative visualization because their layout is determined by features of the graph. Vertices need to grouped by a common feature, and are assigned their own axis. Then their position on that axis is determined by a property of the vertex such as centrality. This allows easy visual comparison of plots. As we make our first exploration of hive plots, let's start with a directed random graph like this one. Here is how we'd traditionally visualize it using igraph.
3. Introduction to hive plots
This is a traditional 'hairball' style plot that we've used so far.
4. Introduction to hive plots
This is the code we'll use to make our first hive plot. The first step is converting our igraph object to an edgelist and adding a weight column. Then we use edge2HPD() to convert the dataframe to a hive plot object. Next we set the axis and radius of each node and then we can make our first plot. As we'll see, axis and radius determine how our data is laid out in the plot.
5. Introduction to hive plots
In this case because our example is a random graph, we've arbitrarily set them. However these should represent some underlying features of the data.
6. Introduction to hive plots
Each axis represents different types of vertices. Then a vertex is placed along the axis based on the radius column of the data frame. Then edges are drawn between each one. This works especially well for plots where you have several features of your graph you want to base your plots on. Here, we can see that we've laid out our vertices evenly along each axis.
7. Modifying hive plots
Hive objects have two properties you can modify, nodes and edges. We can set the axis and radius of each node according to the underlying features we choose, in this case it's just to create evenly spaced points for our example. You can also modify edge properties. Here we'll set random edge weights and then the color of each edge based on the originating axis.
8. Hive plot example
Now we have a finished hive plot. It shows a large amount of information visually and is a great alternative to traditional hairball plots if your data fits it's paradigm. Next we'll introduce another alternative, biofabric plots.
9. Biofabric plots
Biofabric plots work by arranging vertices along the x-axis left to right with the most densely connected vertices grouped on the left, with vertex label proportionally sized to the density. The y-axis has the same arrangement. In this example we'll use a small undirected graph with vertices labeled as letters. Biofabric plots are easy to make, we call the function bioFabric() on an igraph object and then we visualize it using an htmlwidget by using the function bioFabric_htmlwidget().
10. Biofabric plots
Here is the full graph. It is easiest to read though using the htmlwidget implementation.
11. Biofabric plots
If we want to see all the vertices connected to vertex B, we simply put our mouse over it in the htmlwidget and read left to right and see which vertices are connected to that line. In this case we can see that vertex B is connected to D, F, E, and G.
12. Let's practice!
Now lets apply some of these new methods to our existing data sets!