Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

In a famous plot, Charles Minard visualised the losses of the French Army in the Russian campaign of Napoleon:

enter image description here

(another nice example is this xkcd plot)

Is there a canonical name for this type of visualisation? I'm actually looking for an R package to create such plots, but I don't even know how to look for it.

EDIT:

As I could not find a good package in R do do this type of plots, I have created my own, called "riverplot" -- you can download it from CRAN. Here is a simplified version of the above diagram:

enter image description here

And an example of what other diagrams can be created with the package:

enter image description here

share|improve this question
3  
flow map –  user603 Feb 19 at 11:11
    
Hmmm...will have to check this out for this -> stats.stackexchange.com/questions/57359/… Thanks. –  D L Dahly Mar 6 at 16:39
    
Feel free to contact me if there are any problems (there will be). –  January Mar 7 at 9:41

3 Answers 3

up vote 20 down vote accepted

It is a map, and so cartographers would likely refer to it as a thematic map (as opposed to a topographical map). The fact that many statistical diagrams have unique names (e.g. a bar chart, a scatterplot, a dotplot) as opposed to just describing their contents can sometime be a hindrance. Both because not everything is named (as is the case here) and the same name can refer to different types of displays (dotplot is a good example).

In the Grammar of Graphics Wilkinson describes a graph as geometric elements displayed in a particular coordinate system. Here he refers to Napoleon's March as a path element whose width represents the number of troops. In this example the path is drawn in a Cartesian coordinate system whose points represent actual locations in Europe. The points are connected as a representation of the journey Napoleon and his army took, although it likely does not exactly trace the journey (nor does the wider element at the start mean the army took up more space on the road!)

There are many different software programs that have the capabilities to to draw this type of diagram. Michael Friendly has a whole page of examples. Below is a slightly amended example using the ggplot2 package in R (as you requested an example in R), although it could certainly be replicated in base graphics.

mydir <- "your directory here"
setwd(mydir)
library(ggplot2)

troops     <- read.table("troops.txt", header=T) 
              #data is from Friendly link
cities     <- read.table("cities.txt", header=T) 
              #http://www.datavis.ca/gallery/minard/ggplot2/ggplot2-minard-gallery.zip
temps      <- read.table("temps.txt", header=T)
temps$date <- as.Date(strptime(temps$date,"%d%b%Y"))

xlim <- scale_x_continuous(limits = c(24, 39))
p <- ggplot(cities, aes(x = long, y = lat)) + 
     geom_path(
               aes(size = survivors, colour = direction, group = group), 
               data=troops, linejoin = "round", lineend = "round"
               ) + 
     geom_point() + 
     geom_text(aes(label = city), hjust=0, vjust=1, size=4) + 
     scale_size(range = c(1, 10)) + 
     scale_colour_manual(values = c("grey50","red")) +
     xlim + coord_fixed(ratio = 1)
p
ggsave(file = "march.png", width=16, height=4)

enter image description here

Here are a few of the things that make this different than the original:

  • I did not display the temperature graph at the bottom of the plot. In ggplot2 you can make a separate graph, you cannot draw lines across the separate graph windows though.
  • Minard's original graph shows the path diminishing in steps between cities. This graph does not interpolate the losses like that, and shows abrupt changes from city to city. (Troop sizes are taken from a diary of a physician who traveled with the army I believe)
  • This graph shows the exact location of the contemporary cities, Minard tended to bend space slightly to make the graph nicer. A more blatant example is the location of England in Minards map of migration flows.
share|improve this answer
    
I accept this answer, because this is the precise, and exhaustive, answer to my question. It is my fault that my question was less then perfect and that I actually meant something else; what I really meant were the Sankey diagrams :-) –  January Feb 19 at 19:21
    
You're on the right lines (excuse the pun) with "It is a map, and so cartographers would likely refer to it as a thematic map (as opposed to a topographical map)." However, there are many kinds of thematic map. This kind is usually referred to as a flow line map. Examples at google.ca/… –  martin f Feb 20 at 22:55

I have found it. What I was looking for is called a "Sankey diagram". Although there seems to be a tutorial on generating these graphs using rCharts, apparently there is no R-only package for this type of graphs yet on CRAN.

share|improve this answer
    
Hey, a chance for you to publish a CRAN package! :-) –  Carl Witthoft Feb 19 at 15:57
    
Definitely. I already started dabbling with the code. I will, however, use this opportunity to recommend my package pca3d :-) cran.r-project.org/web/packages/pca3d/index.html –  January Feb 19 at 19:23
    
Here you go-- I have created the package (see Edit in the question). –  January Feb 27 at 14:39
1  
So, January released a package in February. I'll ... March over to get it. :-) –  Carl Witthoft Feb 27 at 15:46

I don't think so. It includes so many elements I doubt it lends itself a single canonical name. That said, you could look for ribbon plot, parallel coordinates plot, and (thanks to the comment above from user603) flow map (and searching for flow maps certainly seems the way to proceed). A web search for "replicate Charles Minard's visualization" led to these two possibly useful links. 1, 2.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.