Back to draw-Gnuplot

The Terrible Fait of Napoleon's Great Army in Russia. 1812

The French engineer Charles Minard (1781-1870) illustrated the disastrous result of Napoleon's failed Russian campaign of 1812. The graph shows the size of the army by the width of the band across the map of the campaign on its outward and return legs, with temperature on the retreat shown on the line graph at the bottom. Many consider Minard's original the best statistical graphic ever drawn. (See here for more information.)

Maxima's version of this graph is based on the data provided by the site above.

```load(worldmap) \$

troops : args(rest(troops)) \$

lista : [] \$
for k:2 thru length(troops) do
(if troops[k][5] = troops[k-1][5]
then (if troops[k][4] = 'A
then lista : cons([color = "light-blue"], lista)
else lista : cons([color = "red"], lista),
lista : cons([ line_width = troops[k][3]/13600,
points([[troops[k-1][1], troops[k-1][2]],
[troops[k][1], troops[k][2]]]) ],
lista) )  )  \$
segment : apply(append, reverse(lista)) \$

location_marks: points(args(rest(map(lambda([z],[z[1], z[2]]),
cities)))) \$

formatted_cities:
apply(label,
args(rest(map(lambda([z],[string(z[3]), z[1], z[2]-0.1]),
cities)))) \$

temperature : points(submatrix(rest(temps),3,4,5)) \$

dates : apply(label,
map(lambda([z], [concat(z[4],"-",z[3]), z[1], z[2] - 5]),
args(submatrix(rest(temps), 5)))) \$

z: region_boundaries_plus(23, 57, 40, 52) \$

draw2d(

/* general settings */
terminal   = svg,
dimensions = [600,450],
title      = "The Terrible Fait of Napoleon\''s Great Army in Russia. 1812",
xlabel     = "Longitude",
ylabel     = "Latitude",
xrange     = [23, 40],
yrange     = [52,57],
grid       = true,

/* country names */
color = brown,
label (["LATVIA", 26.8, 56.2],
["LITHUANIA", 25.4, 55.6],
["BELARUS", 28.3, 55.8],
["RUSSIA", 32.4, 56]),

/* advance and retreat of troops */
point_size = 0,
points_joined = true,
segment,

/* Legend based in dummy points outside plotting range */
point_type = filled_square,
point_size = 1,
color      = "light-blue",
points([[1000, 1000]]),
key        = "Retreat",
color      = red,
points([[1000, 1000]]),
key        = "",

/* country boundaries */
color      = black,
line_width = 1,
geomap(z),

/* cities and their names */
points_joined = false,
point_type    = filled_circle,
location_marks,
formatted_cities,

/* Celsius temperatures in secondary y-axis */
yaxis_secondary  = true,
ytics_secondary  = true,
yrange_secondary = [-50, 100],
ytics_secondary  = {["0 C", 0],
["-10 C", -10],
["-20 C", -20],
["-30 C", -30],
["-40 C", -40]},
points_joined    = true,
color            = "light-gray",
point_size       = 0,
points([[25, 0],   [40,0]]),
points([[25, -10], [40,-10]]),
points([[25, -20], [40,-20]]),
points([[25, -30], [40,-30]]),
points([[25, -40], [40,-40]]),
color            = navy,
point_size       = 1,
point_type       = up_triangle,
dates,
temperature ) \$
```