1869 of Napoleons Russian Campaign

Some data visualisations can be perceived as something more than figurative representations of numerical or statistical analyses, and certain examples of infographics give us something more than simply visual information. Often it is the design that fascinates us, and even the idea it expresses. Sometimes it is also the objective that fascinates us. In the history of data visualisations, there are some examples which stand out in that way, and constantly arouse such attentions.

Some history

In 1812, Napoleon made his big mistake and the years of triumph came to a sudden end.

Tsar Alexander I, without making a clear break with France, refused more and more openly to follow the emperor’s dictates. Napoleon then decided to invade the Tsar’s Empire with a colossal army of over 600,000 men. On the evening of 22nd June 1812, Napoleon himself rode his horse along the west bank of the Niemen River, preparing to cross into Russian territory. Two days later, the Grand Armée, the largest European army to date, crossed the Niemen River and headed for Moscow. St. Petersburg turned down the final peace offer from a Napoleon who, for every answer, ordered his army into Poland.

In the first moments of Napoleon’s rapid advance, the Russians offered little resistance and avoided an open-air confrontation with the French at all costs because they knew they would lose.

After the Battle of Borodinus (7 September)-one of the bloodiest battles of mankind, which was won by the French-the Russian army was forced to retreat, leaving the way open for an already evacuated Moscow. But the Russians did not give up and managed to recruit a record one million men (100,000, just around Moscow). Indeed, their astounding ability to cover casualties would be decisive in their final victory.

Finally, Napoleon enters Moscow hoping that Tsar Alexander I himself will offer him capitulation. But the Russians did not relent in their defence of Moscow, looting and firing on it so that the French could not retreat anywhere, while at the same time restarting a strong pressure manoeuvre to expel Napoleon’s troops from the city.

Having barely survived the elements, the situation became untenable for the Napoleonic troops, who had to retreat on 19 October, scarcely two months after the occupation. A withdrawal in which Kutuzov would attack them relentlessly in an atrocious guerrilla war, furthermore, at the beginning of a harsh winter that was beginning to hinder the arrival of supplies to the French army.

A desperate situation that was further aggravated by several other factors: Austrian and Prussian soldiers and other troops from the occupied countries began to change sides, passing on crucial information to the Russians. Furthermore, winter made it impossible for the horses of the French troops to graze, so they died by the thousands and, although their meat fed the troops, it caused them to advance slowly and painfully on foot, causing the soldiers to freeze to death.

Victims of the cold, disease, hunger and exhaustion, the French troops could no longer put up a fight. On 14 December 1812 they were finally expelled from Russian territory when they crossed the Niemen River back: the same point at which their aggressive military campaign had begun, then with signs of success. Fifty-eight thousand French soldiers survived in a tragic campaign that ended with one million dead divided almost equally between Russians and Gauls.

Defeat would earn Napoleon exile on the island of Elba. Russia’s victory, however, strongly strengthened the national identity while underpinning a strong patriotism that would eventually lead to the country’s modernising and revolutionary drive in the 19th century.

Recreation of Charles Minard’s Data Visualisation

Let´s work

Inside requeriments.txt:

pandas
altair
numpy
vega_datasets

Altair package

With Altair, you can spend more time understanding your data and its meaning. Altair’s API is simple, friendly and consistent and built on top of the powerful Vega-Lite visualization grammar. This elegant simplicity produces beautiful and effective visualizations with a minimal amount of code.

import pandas as pd
import altair as alt
import numpy as np
from vega_datasets import data
cities = pd.read_csv("data/minard_cities.txt", sep=" ", names=["lon", "lat", "city"])
cities
png
temperatures = pd.read_csv("data/minard_temperature.txt", sep=" ", names=["lon", "temp", "days", "day"])
temperatures
png
troops = pd.read_csv("data/minard_troops.txt", sep=" ", names=["lon",  "lat", "survivors" , "direction", "division"])
troops.head()
png
temperatures["label"] = temperatures.fillna("").apply(
axis=1, func=lambda row: "{}° {}".format(row[1], row[3].replace("-", " "))
)
temperatures.head()
png
troops = troops.sort_values(by=["division", "survivors"], ascending=False)
troops.head()
png
troops_chart = alt.Chart(troops).mark_trail().encode(
x='lon:Q',
y='lat:Q',
size=alt.Size('survivors', scale=alt.Scale(range=[1, 75]), legend=None),
color=alt.Color('direction')
)
troops_chart.save("plot/troops_first_try.html")
troops_chart
troops_chart = alt.Chart(troops).mark_trail().encode(
longitude='lon:Q',
latitude='lat:Q',
size=alt.Size(
'survivors',
scale=alt.Scale(range=[1, 75]),
legend=None
),
detail='division',
color=alt.Color(
'direction',
scale=alt.Scale(
domain=['A', 'R'],
range=['#EBD2A8', '#888888']
),
legend=None
),
).project(
type="mercator"
)
troops_chart.save("plot/troops.html")
troops_chart
# Small manipulation to scatter the troop size text a bit
troops_text = troops.iloc[::2, :].copy()
troops_text["lon"] += 0.13 * (troops_text["division"])
troops_text["lat"] += troops_text["direction"].replace({"A": 0.35, "R": -0.21})
troops_text.head()
png
troops_text_chart = alt.Chart(troops_text).mark_text(
font='Cardo',
fontSize=7,
fontStyle='italic',
angle=280
).encode(
longitude='lon:Q',
latitude='lat:Q',
text='survivors'
).project(
type="mercator"
)
troops_text_chart.save("plot/troops_text.html")
troops_text_chart
cities_chart = alt.Chart(cities).mark_text(
font='Cardo',
fontSize=11,
fontStyle='italic',
dx=-3
).encode(
longitude='lon:Q',
latitude='lat:Q',
text='city',
).project(
type="mercator"
)
cities_chart.save("cities.html")

x_encode = alt.X(
'lon:Q',
scale=alt.Scale(
domain=[cities["lon"].min(), cities["lon"].max()]
),
axis=None
)
cities_chart
y_encode = alt.Y(
'temp',
axis=alt.Axis(
title="Temperature on Retreat",
grid=True,
orient='right'
)
)
y_encodeY({
axis: Axis({
grid: True,
orient: 'right',
title: 'Temperature on Retreat'
}),
shorthand: 'temp'
})
temperatures_chart = alt.Chart(temperatures).mark_line(
color="#888888"
).encode(
x=x_encode,
y=y_encode
) + alt.Chart(temperatures).mark_text(
dx=5,
dy=20,
font='Cardo',
fontSize=10
).encode(
x=x_encode,
y=y_encode,
text='label'
)
temperatures_chart.save("temperature.html")

temperatures_chart = temperatures_chart.properties(
height=100
)
temperatures_chart
map_chart = troops_chart + cities_chart + troops_text_chartmap_chart

Final result

final_chart = alt.vconcat(map_chart, temperatures_chart).configure_view(
width=900,
height=400,
strokeWidth=0
).configure_axis(
grid=False,
labelFont="Cardo",
titleFont="Cardo"
)
final_chart.save("plot/minard_chart.html")
final_chart

I hope you like it.

No matter what books or blogs or courses or videos one learns from, when it comes to implementation everything can look like “Outside the Curriculum”.

The best way to learn is by doing! The best way to learn is by teaching what you have learned!

Never give up!

See you on Linkedin!

Reference:

https://sciencenorway.no/blog-blog-from-numbers-to-graphics-statistics/charles-joseph-minards-map-of-napoleons-flawed-russian-campaign-an-ever-current-classic/1618695

https://github.com/blue-yonder/grammar-of-graphics-minard-example

http://agrega-2hapre2.pntic.mec.es/repositorio/04122014/8c/es_2014120412_9181756/las_guerras_napolenicas.html

Master in Data Science. Passionate about learning new skills. Former branch risk analyst. https://www.linkedin.com/in/oscar-rojo-martin/. www.oscarrojo.es

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store