Introduction

R is a great tool for working with data. Data manipulation becomes a piece of cake and it has a lot to offer for story telling and visualisation. ggplot2 is a great package for static visuals and it works great for the majority of the data projects. That being said, there are situations when adding interactive plots can improve the story you are trying to tell with your analysis. Plotly is a great package for creating interactive plots and it’s very similar to ggplot2, so you can pick it up really quick. If you really want to feel the power of plotly you can use it in combination with shiny web apps but this is for another time.

Midterm election 2018 data

Election data is a good example of how interactive graphs can facilitate data story-telling. The data has information on the US Midterm Election in 2018. You can find it here

Highest Turnout

First let’s see what states had the highest turnout in 2018.


Usually the turnout for midterm elections is not very high. This was not the case for 2018. Let’s see how 2018 was different compared to the previous elections.

Turnout Change

Here we can see that the turnover grew in almost every state except Louisiana and Alaska.

Below you can see how the turnover changed for all the states.

Turnout Change Map

Fundraising

Both parties felt important to get the seats in the Senate and a lot of money was spent on candidates. What candidates spent the most?


Let’s see who actually won the elections.

Senate Winner by State

FLORIDA

There was a lot of controversy around the elections. Especially in Florida. The race was too close to call, and the recount process was as controversial as the race.

Here is re-creation of a county-level map of the percentage of the two-party vote that the Republican candidate, Rick Scott (who actually won the election), received according to the first set of results.