Life expectancy changes

I played around with D3 some more. This time I used data from The World Bank to look at life expectancy over time and by country. The data goes back to 1960 and up to the most current estimates for 2009. Each line represents a country, and you can see a few more details by rolling over each one.

More usefully, you can select regions, as defined by The World Bank, and see how groups of countries have changed or compare with other regions. For example, the shot above shows East Asia and Pacific in pink and Sub-Saharan Africa in green.

The major dips for some of the countries jumped out at me immediately. A few quick searches suggest that they coincide with war, such as the Bangladesh Liberation War in the 1970s, the Iran-Iraq War in the 1980s, and the Rwanda Civil War in the 1990s. There’s also a smaller dip for Iraq starting in early 2000.

Some countries, such as Seychelles, didn’t have data that went back to 1960. In this case, the line starts where annual data became available.

There are a few interactions that I’d add to make the graphic more complete, but don’t have time to get to right now. For example, as I clicked around, I wanted to keep a selected country highlighted to see how it compared to others. It’d be informative to point out periods of war on the graphic, too.

See the full interactive here, and as usual, comments are welcome.

[Life Expectancy]


  • Some kind of zoom function would come in very handy. Since the lines are very close to eachother, it’s hard to find data for a specific country. I couldn’t find The Netherlands for instance.

    • Two more suggestions: 1) an extra layer of context-dependant tabs for country would be great, so people can find a country of interest by name rather than by data, 2) I wonder if you can find a way to get D3 to simulate Illustrator’s ‘Multiply’ blend mode, so you could see density and unusual curves (e.g. Puerto Rico) amid that thicket of lines towards the top of the chart?

  • Is pretty interesting to look how the life expectancy drops in the early 2000 in South Africa and most of the country surrounding it

    • I was wondering the exact same thing – what happened in Southern Africa in the mid 1990s to cause almost every country in the region: South Africa, Swaziland, Lesotho, Botswana, Zimbabwae, Namibia – to all begin a decline in life expectancy at almost the same time?

      The impression I get from some very shallow research suggests this is the AIDS pandemic kicking in, and that Mozambique only appears to be less affected because AIDS deaths increasing in the early 1990s co-incided with less violent deaths following the end of the civil war. I didn’t realise HIV hit the south of Africa so much harder and faster than the rest of the continent – map graphic over time, anyone?

      • Yes all the dips from 1990s onwards in Sub-Saharan Africa is likely to be HIV/AIDS related. I don’t think South Africa is hardest hit. Zimbabwe, Botswana etc had bigger issues. One also need to think about the quality of data for these countries. In South Africa only 80% of deaths are estimated to be reported. One would need to see how reporting in the different African countries vary as well as how the results are adjusted.

      • Why is spline interpolation used?!? Seriously: If there isn’t enough data, why interpolate it with a method that changes the intermediate points drastically? So according to this plot, we can predict mass murder in countries with poor data recordings by a huge *increase* in life-expectancy?!?

        To answer a previous question: The plots, which are completely smooth are completely worthless as well, because there are at most a handful of data-points available (sometimes you can ‘see’ there are only 2 or 3) and those few points got interpolated non-linearly.

      • I didn’t use splines.

  • Interesting. I would choose a different color for North America, though.

  • One more interesting observation: Slowly mouse down the chart, and note the countries with unusually spikey lines. With no exceptions I can see, these are either 1) countries with very small populations such as Malta, Seychelles (to be expected since random variation will be more pronounced here) or 2) countries from the European Soviet/Communist bloc: Russia, Czech Republic, Poland, Bulgaria, Lithuania, Latvia… Curiously, Asian soviet republics (e.g. Azerbaijan, Tajikistan) have lines as smooth as any other. Any theories as to why?

  • Gary Alan Jackson October 13, 2011 at 7:56 am

    Very cool. I’m working on a static life expectancy piece right now. It’s nice to see a different spin on the same data!

  • Art Vandelay October 13, 2011 at 8:13 am

    The chart looks nifty, but is practically useless since you need 1-pixel precision to find a specific country.

    • David von Essen October 13, 2011 at 8:24 am

      I got the same problem as Art Vandelay(using Ubuntu and Firefox 7). It would be nice if one could at least select a country by clicking on the life-expectancy line or something like that.

    • Yeah, one trick for making this easier is to use thick invisible lines in the background (with style pointer-events:all). These invisible lines are used for mouseover but don’t change the visual appearance.

      Alternatively, you could create an invisible Voronoi overlay from the control points and use that, similar to the Protovis point behavior. :)

  • Perhaps another navigation system could be envisioned where each region was listed vertically. Selecting a region would open an accordion style listing of all the countries in that region. Then each country could be selected from this list. Might get a little long with some regions (the Europe region could be broken down further to account for this).

    You could also have another selection for “all” that would allow toggling the gray lines. This would help when comparing North America, and other regions with few countries.

  • Not sure why, but it works for me in chrome, doesn’t seem to work for me in firefox.

  • Great work! Reminds me of the Hans Rosling Ted talk.

    It would be really cool to color code by continent or sub-continent regions and be able to highlight a few at a time. Some other comments mentioned similar features as well.

    From a quick look it seems most major nations have seen less increase in the past 50 years than emerging nations – I’m sure 1st world problems like obesity & diabetes have played a role in this.

  • It’s definitely not a major point of this post, but for historical accuracy, I just wanted to note that mid-90s Rwandan dip was most likely due to the Rwandan genocide rather than the Rwandan civil war. The genocide was the murder of 800,000 people (well over 10% of the entire population) and was clearly distinct from the civil war, which was pretty inactive at that point (and in fact, the genocide only stopped once the side that had clearly lost the civil war re-activated and re-invaded the country). Wikipedia has accurate articles on both the Rwandan genocide and the Rwandan civil war for those wanting more information.

  • what’s the software this has been made with? i like the visualization :)

  • Hi, is the source code for this graphic available by any chance? Id love to take a look at it.