Blog

11 mai 2017 · R · XGBoost · France

Le Pen's 2017 map was drawn in 2012

In French towns of 1,000 people or more, Marine Le Pen's 2012 first-round score accounts for 89% of the variation in her 2017 score, and she gained most where she was already strongest. Her 2017 map held again in 2022, explaining 88% of her score. Education comes a distant second; altitude barely registers.

Article en anglais.

To know where Marine Le Pen would do well in the first round of the 2017 presidential election, you needed one number: how she did in 2012. Across the 9,628 French towns of 1,000 inhabitants or more, her 2012 score accounts for 89% of the town-to-town variation in her 2017 score. The best social or economic indicator, the share of adults with a university degree, accounts for 28%.

The analysis combines the official first-round results of 23 April 2017 for every commune of mainland France and Corsica, published by the Ministry of the Interior, with the 2012 first-round results and about 170 local indicators from INSEE, the national statistics office: education, income, employment, immigration, housing, businesses, elevation and more. All figures below are computed per commune, the smallest unit of French local government.

Half the communes, a third of the votes

Le Pen came first in 18,684 communes, 53% of those with a result. That makes the map of the first round look overwhelmingly hers. But her communes are small, with a median population of 457, and together they cast 36% of the valid votes. Emmanuel Macron, who won the round nationally, came first in only 20% of communes, which cast 39% of the votes.

The same map, amplified

Le Pen raised her score in 95% of towns of 1,000 or more between 2012 and 2017; across those towns her share of the vote went from 17.9% to 21.1%. The rise was not spread evenly. Where she had 8–10% in 2012, the median town gave her half a point more. Where she already had 30–32%, it gave her 6.9 points more. On average, each point she held in 2012 was worth 1.27 points five years later: her strongholds grew stronger, and her weak spots stayed weak.

The pattern holds in every region. Her 2012 score accounts for 82% of the variation in Hauts-de-France, the old industrial north where she gained most (a median of 8 points per town), and for 88% in Provence-Alpes-Côte d'Azur. In smaller communes, where a handful of votes can swing a percentage, it still accounts for 62%.

Education matters; altitude hardly

Once past history, education is the strongest single signal. Towns with more university graduates gave Le Pen less: the share of adults with a higher-education degree accounts for 28% of the variation in her score, ahead of the share with no qualification (15%), median income (15%) and unemployment (10%). The share of immigrants in a town accounts for under 2%, and what little link there is runs negative: she did slightly worse where immigrants were more numerous.

This analysis started from a curiosity: in Provence, Le Pen's score falls as you climb into the Alps, an echo of André Siegfried, the geographer who argued in 1913 that "granite votes right, limestone votes left". The link is real there, a correlation of −0.24 across the region's towns, and the same in Auvergne-Rhône-Alpes. But across France it vanishes: elevation accounts for 0.2% of the variation. In Hauts-de-France and Brittany it even runs the other way, with Le Pen doing slightly better on higher ground.

Education behaves differently. Its link with the Le Pen vote has the same sign and a similar strength in every region, strongest in Hauts-de-France, where the share of graduates alone accounts for 59% of the variation between towns. Income is negative everywhere too. Unemployment is a northern story: a clear link in Hauts-de-France, almost none in Provence, and a slightly negative one in Brittany.

Education also helps explain where she outran her own past. Taking the 2012 score as the baseline, Le Pen did 1.4 points better than it predicted in the fifth of towns with the fewest graduates (under 16% of adults), and 1.3 points worse in the fifth with the most (30% or more). Towns with many manual workers show the same tilt: +1.0 points in the fifth where workers made up a third of the workforce or more, −1.3 points where they were under 18%. Both links are moderate (correlations of −0.33 and +0.31) and stronger in towns of 5,000 or more (−0.44 and +0.45).

Five years later, the same map

The 2022 first round put the 2017 finding to a second test. Matching the official 2022 results to the same 9,584 towns, Le Pen's 2017 score accounts for 88% of the variation in her 2022 score, almost exactly the share her 2012 score explained in 2017. A decade on, her 2012 score still accounts for 75%. The pattern holds in large towns (93% for towns of 5,000 or more) and, more loosely, across all 34,801 communes that could be matched (71%).

What changed is the shape of the growth. Between 2012 and 2017 she gained most where she was already strong. Between 2017 and 2022 she gained in 86% of towns, a median of 2.9 points, and the gain was roughly the same everywhere: between +1.6 and +3.7 points whatever her starting level, slightly smaller in her strongholds. The slope of 2022 on 2017 is 0.94, against 1.27 for 2017 on 2012. Part of the explanation is a new competitor on her flank: Éric Zemmour took 7% of the vote in these towns. Le Pen and Zemmour together reproduce her 2017 map at a slope of 1.00 (R² 89%), at 30.1% of the vote against her 21.1% alone five years earlier.

What a machine-learning model adds

We also trained a gradient-boosted tree model (XGBoost) to predict which of the four leading candidates came first in each commune, using all the indicators above, including the 2012 results. Trained on 70% of communes and tested on the other 10,542, it picked the right winner in 74% of cases.

That sounds better than it is. Le Pen came first in 53% of the test communes, so a model that always answered "Le Pen" would already be right 53% of the time. The model was best at spotting her communes (87% of them found) and worst at Jean-Luc Mélenchon's (53%) and François Fillon's (60%). And the four inputs it leaned on most were the 2012 scores of Le Pen, Nicolas Sarkozy, Mélenchon and François Hollande, well ahead of any social indicator. The model mostly learned what Figure 3 shows: French towns vote much as they voted five years before.

About the data

Results: first round of the 2017 and 2012 presidential elections by commune, Ministry of the Interior, via data.gouv.fr. Shares are of valid votes (suffrages exprimés). The 2022 first-round results by commune are the Ministry of the Interior's final results on data.gouv.fr (downloaded October 2026), matched on the INSEE commune code; 44 of the 9,628 towns, mostly merged into new communes since 2017, could not be matched. Local indicators: INSEE, mostly 2013 census and tax data; where a commune's median income was missing, the value for its arrondissement was used. 475 communes without a 2017 result in the merged file were left out.

Figures 2 to 4 use the 9,628 to 9,674 towns of 1,000 inhabitants or more with the data needed, because percentages in very small communes move by several points on a few votes. Correlations are Pearson coefficients with one value per town, unweighted by population; the R² in Figure 3 is the square of each single-variable correlation, so the shares overlap. Correlation describes where Le Pen did well, not why voters chose her.

The data set, the R notebooks and the model code are on GitHub. Analysis in R; figures recomputed with DuckDB from the published data set.