Streamgraph visualization of global warming

Streamgraph of global warming

Streamgraphs are very pretty!

Streamgraphs are a very catchy way to represent stacked area graphs. Streamgraphs are most commonly used to represent time series data. I encountered streamgraphs for the first time during a coursera data visualization class and I immediately wanted to try to reproduce them. Needless to say it took quite a bit of work to master the technique to produce a streamgraph. Since there was not an implementation in any of the languages I knew, I had to learn how to use d3.js and therefore get some experience with JavaScript.

For this representation I got data from the NASA website. I chose the dataset with global mean estimates based on land-surface air temperature anomalies only (meteorological station data) split in zonal annual means from 1880 to 2014. I imported the data in R and transform it from wide to long format because the code I found to generate the streamgraph was reading a csv file with data in long format. Importing the csv file and plotting the streamgraph was quite straightforward if one is a bit familiar with JavaScript and d3.js. However, the interpretation of streamgraph remained quite cryptic. For example, I did not even know which zone was depicted. I thought of adding a legend, but a list with 14 items defeated the purpose of the graph being clear and concise. Therefore, to simplify the comprehension of the graph, I added to the visualization a circle, which represents the earth. The circle is crossed by lines, which represent the latitudes (or parallels) delimiting the zones for which I had temperature data. I then thought of including a moving bar scrolling through the 14 zones to allow the identification of the zone to which the stream belonged.

Today producing a streamgraphs is much easier. For example R can produce code to get a streamgraph on a webpage (using d3.js) as shown from this stackoverflow post. There are some limitations to the R approach. For starters error interpretation is quite challenging because, for example, the messages are cryptic and their source is not unique. It took quite a bit of digging to figure out the error I was getting was from not setting a time series variables in my dataframe, whereas I thought simply specify I was using milliseconds was enough). Moreover, it might happen that even without error nothing is displayed on the html file and one does not know why. However, for simple things the R approach will work, and it will make your pictures look stunning, if not more comprehensible.

The question remains whether streamgraphs are also helpful in term of visualization.
I suspect the visualization is complex to grasp. This feeling was (partially) comfirmed during the feedback session of the data visualization course in which one of the five students reviewing my work literally stated he had no idea what s/he was looking at. I appreciated the honesty. The other four students just really liked the visualization, but the assignment required the students to work with the same data, so these guys knew what they were looking for. Otherwise I wonder whether they would have had a clear idea of what the pretty ‘tresses in the wind’ represented if they would not have worked with the data or followed the data-visualization course themselves.
In conclusion, it is my impression that if a picture/graph is worth a 1000 words, streamgraphs might not be there yet. But maybe it is me who should find more adequate data to visualize using this truly beautiful visualization technique.

On my webpage there is an animated version of this graph as well as an interactive one. On github the code and data to generate the visualizations.

I have been working with streamgraphs in R as well. In later posts I describe how to make a simple streamgraph in R (see here). Here I use streamgraphs to give a more elegant and comprehensive representation of some data set I have been working.

Streamgraph visualization of global warming

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s