Skip to content

Rense Corten

Computational sociology, social networks, and cooperation

Menu
  • About me
  • Blog
  • Research
    • Social Network Analysis with Stata
  • Teaching
Menu

Drawing social networks in Stata with Netplot

Posted on 12/04/2010

An important part of what makes social network analysis so fascinating to broad audiences is the possibility of visualization of networks. You can already learn a lot about the structure of a network simply by looking at a picture (although the choice of the ‘right’ picture is no trivial thing), and they can be esthetically pleasing, too.  Specialized software packages like Pajek offer great tools for network visualization,  but if you are working with Stata, having to export your data to Pajek for every simple picture is a pain.

My Stata program netplot is a first* step to making network visualization available within Stata. Assuming that you have data stored as edges or arcs,  the program lets you draw plots of your network, using multi-dimensional scaling to determine the placement of the nodes. Alternatively, you can have your nodes arranged on a circle. The use of labels to identify nodes in the graph is also supported.

Below are some examples:


//create a random network with 10 nodes
//(code adopted from the helpfile of stata2pajek)
clear
set obs 200
gen i=int(uniform()*10)+1
gen j=int(uniform()*10)+1
contract i j, freq(strength)
drop if i==j
sort i j
drop if strength <3 // --> keep only the "stronger" links

// Draw the network
netplot i j
Network drawn bij netplot
// Draw with labels
netplot i j, label
Network picture with labels
// Use a circle layout
netplot i j, type(circle) label
Circular network picture

I admit that multidimensional scaling is not the most fancy node placement algorithm around (see this article by Freeman for an overview of available techniques), but the good thing about it is that the procedure is already included in Stata by default. Getting actually nice graphs with Netplot might take a few trials, but it’s a start. To install, type ssc install netplot. More details and other examples are provided in this working paper. [UPATE: the paper has by now been published in the Stata Journal. Get it here.]

*) As far as I know, tell me if I’m wrong!

4 thoughts on “Drawing social networks in Stata with Netplot”

  1. Pingback: Network Graphs in Native Stata Code « Code and Culture
  2. Hannah says:
    13/04/2010 at 16:56

    Awesome! Thanks this is very impressive
    hannah

  3. Pingback: Tweets die vermelden Rense Corten , Archive » Drawing social networks in Stata with Netplot -- Topsy.com
  4. Pingback: Social network packages poll « Code and Culture

Comments are closed.

Recent Comments

  • michal on Duncan Watts on common sense
  • Rense on On unsolved sociological questions
  • Gabriel rossman on On unsolved sociological questions

Categories

  • Everything (8)
  • In het Nederlands (1)
  • Other (2)
  • Politics (2)
  • Science (4)
  • SNA with stata (9)
  • Social Networks (27)
  • Social Science (16)
  • Sociology (32)
  • Stata (7)
  • The Netherlands (8)
  • The Universe (2)

Blogroll

  • Brokering the Closure
  • Chris Snijders
  • Code and Culture
  • Orgtheory.net
  • Permutations
  • Social Science Statistics Blog

Links

  • GECS
  • ICS
  • INSNA
  • International Network of Analytical Sociologists
  • Mathematical Sociology Section (ASA)
  • My Google Scholar profile
  • My official UU webpage

Contact

r.corten [at] uu.nl
@RenseC

Subscribe

RSS Feed RSS
©2025 Rense Corten | Design: Newspaperly WordPress Theme