Martín González

Visual journalist, designer, map maker.

Where did the Basque Socialists lost 40% of the vote?

Before the latest Basque parliamentary election took place I started working in an explainer. After seeing the election unfold the story was much clearer: the Socialist Party lost 40% of the vote. So we decided to focus on them.

Tools: D3.js, R. With Jorge Galindo.

Go to the interactive
Socialist loss between 2016 and 2009 in each city. Note the log scale in the y axis.

The bar chart

After sketching several charts in ggplot I settled down on a map, a scatterplot and a bar chart. I tried to simplify the bar chart axes as much as I could, thinking about small things as the vertical lines that go along the chart. I also added an arrow to mark the difference between losing and winning votes.

Another small detail is the city label color. When the bars have a dark fill it’s white, but it switches to black when the background is lighter.

First sketch of the bar chart in ggplot.
Final design.


The scatterplot was more complicated. First, I used a log scale to dissipate differences between city sizes. Then I implemented a voronoi diagram to make the tooltip seamless. While a normal voronoi would trigger the tooltip at any distance from the nearest circle, I used a limited distance voronoi, which only triggers a mouse event when the user hovers near a circle.

First sketch with ggplot.

I made other small decisions. There are some dots that suffer from occlusion. To be able to distinguish them while hovering I drew the border of the selected circle again, on top.

The map

The map opens the piece and is crucial to understand the spatial angle of the story: the Socialists lost most of the vote in the biggest cities. It has a heavy annotation layer.