Interactive and Dynamic Social Network Visualization in R

Prof James P. Curley
6th April 2016

Introduction

About Me


I'm an Assistant Professor in Psychology at Columbia University and executive member of the Integrated Animal Behavior Center at Columbia University

https://twitter.com/jalapic

https://github.com/jalapic

http://curleylab.psych.columbia.edu/

Social Networks


  • I'm interested in the social behavior of animals (including humans)

  • Interested in how groups emerge over time and how stable/unstable groups are

  • Most interested in power and dominance structures in social networks

Code, Data, References


  • talk is online here

  • available on GitHub

  • links to individual code/data on slides to recreate examples

Why ?


What are you trying to communicate to the audience?

What insights are you trying to get for yourself?

Are network graphs the right way to represent your data?

Why ?


Are static networks sufficient ?

Why do you want interactivity ?

Why do you need dynamic network visualization?

Goals of this Presentation


  • Acquaint users with network drawing options in R

  • Showcase more recent package development


  • Get you (and me) how to think about how best to present network data

  • Focus on dynamic and temporal aspects of network viz

Talk Format


By example - usually CODE then EXAMPLE

Will try to explain the relevant bit of code for each - if run out of time, will skip code and just show more of the examples.

Some things are written with audience in mind, so code may not be as compact as might otherwise expect.

I'm mostly focusing on networks of <500 nodes (most even smaller). This is because these are what I typically analyze, but also they are useful to demo features. Larger networks may require special attention.

Disclaimer 1.


These slides were made for a 50-60 minute talk at the NYC RStats meetup. I obviously cannot include everything!

Will add extra details to the online version covering some packages that I don't go over in detail.

I try to provide good examples, but there probably are more aesthetically pleasing and better use cases for each feature.

Disclaimer 2


This talk is made in RStudio using Rpresentation. I hope it's viewable on all browsers/platforms !

Some visualizations may be slow to render, you might need to refresh broswer for some dynamic visualizations.

Note: most static images have been improved with the rsvg package.

Section I - Static Graphs

Static Graphs

There are many packages for drawing static network plots, some as extentions of network analysis packages and others as extension of plotting packages:

  • igraph
  • statnet: sna/network

  • ggnet

  • ggnetwork

  • ggraph

Different packages have different strengths/weaknesses. Choose the one right for the question/visualization.

Static Graphs


In this talk I won't focus on plotting static 2D network visualizations in igraph, sna, and network as there are many good resources for doing this.


This one by Katherine Ognyanova is one of the best.

Static Elements to style


nodes/vertices: color, shape, size, border, labels,text-size, position

edges/links: color, size, labels, arrows, curvature, link distance

groups/communities: color, shading, border, lines

graph: layout, color, faceting


There are multiple ways of conveying information about the network properties of nodes and the relationships between nodes in a graph