Sources and Tools:
Data on coronavirus cases was obtained from covidtracking.com. The visualization was created using javascript and the open source leaflet javascript mapping library.This animation shows the number of electoral votes each state had during each of the 59 presidential elections in US history between 1788 and 2020. It’s interesting to see the number of US states and their relative population sizes (in terms of electoral votes) over many different presidential elections. The population is counted every 10 years in the census so if a presidential election occurs between a census, it likely will not see any difference in numbers of electoral votes, unless something else happens (such as addition of a new state to the country).
Instructions
You can use the slider to control the election year to focus on a specific election and toggle the animation by hitting the Start/Stop button. Hovering over each state will tell you the number of electoral votes and the percentage of the total number of electoral votes in that election.
In the elections during and immediately after the US Civil War, we also see some states whose electoral votes for president are not counted (shown in purple). Wyoming, the state with the lowest population in the US, has the highest number of electoral votes per person in the state, while the three most populous states, California, Florida and Texas have the least number of electoral votes per person. Wyoming has four times the number of electors per capita than these 3 states have (i.e. accounting for their population sizes). That will be the subject of another map dataviz.
Sources and Tools:
Data on number of electoral votes by state for each election is from Wikipedia. And the visualization was created using javascript and the open source leaflet javascript mapping library.
function resizemap(){ //this function is called from the javascript from within the iframe after the contents of iframe are loaded (and after an additional 150ms delay) setTimeout(function (){ mm = document.getElementById('mapframe'); mm.height = mm.contentWindow.document.body.scrollHeight+100+"px"; console.log("resize");
}, 150); }
function reloadiframes(){ document.getElementById('mapframe').contentWindow.location.reload(); }
window.addEventListener("orientationchange", function() { reloadiframes(); resizemap(); }, false);
This is a fun little map that shows the number of states that border each state. I’m working on improving the interactivity of maps and this was a good project to try this with. The base map is a choropleth map which color codes each state by the number of states it shares a border with. If you hover over (or touch on mobile) a state, it will highlight the state and show you (and list) the bordering states.
It’s important to note that officially New York and Rhode Island share a water border (between Rhode Island and Long Island, NY) and that Michigan and Minnesota also share a border (in Lake Superior).
Sources and Tools:
Data on state borders was downloaded from state.1keydata.com. And the visualization was created using javascript and the open source leaflet javascript mapping library.
function resizemap(){ //this function is called from the javascript from within the iframe after the contents of iframe are loaded (and after an additional 150ms delay) setTimeout(function (){ mm = document.getElementById('mapframe'); mm.height = mm.contentWindow.document.body.scrollHeight+100+"px"; console.log("resize");
}, 150); }
function reloadiframes(){ document.getElementById('mapframe').contentWindow.location.reload(); }
window.addEventListener("orientationchange", function() { reloadiframes(); resizemap(); }, false);
A record 16 million Americans just filed for unemployment due to the coronavirus pandemic at the end of March and early April 2020. This is an amazingly large number of people and I wanted to visualize how many people this actually is. For context, the US Department of Labor statistics states that in February 2020 (before the pandemic hit the United State) there were 164.2 million workers in the Civilian Labor Force.
The Bureau of Labor Statistics (BLS) site defines “Civilian Labor Force” as such:
This basically means that approximately 10% of the entire workforce of people (both employed and unemployed in Feb 2020) are now out of a job. While 10% is a large, unprecedented number in our lifetimes, comparing these number to the size of the workforce in several states helps to provide more context. The visualization shows a random collection of states whose total labor force is equal to the latest unemployment numbers. If you click the button you can see a different set of states that have the same total labor force.
Predictions are that the number of unemployed will grow as the shutdowns and social distancing measures to contain the virus continue through April and into May. I will update this graph to reflect new numbers as they come out.
And we can only hope that people will be able to manage these tough economic times until we contain the virus and the economy rebounds.
Stay safe out there: stay away from people and wash your hands!
Sources and Tools:
Data on unemployment was obtained from the US Department of Labor website and labor force numbers by state are downloaded from the Bureau of Labor statistics. And the visualization was created using javascript and the open source leaflet javascript mapping library.The coronavirus (SARS-CoV-2) is literally affecting the entire globe right now and changing the way we live our lives here in the US and all over the world.
There are quite a number of different coronavirus-related dataviz out there, but as we shelter-in-place I wanted to add a map that looked at a number of different metrics that tell us about the coronavirus pandemic by US states and look at those metrics on a population basis.
There are a number of data sources that I’ve found that publish data about the coronavirus and the resulting disease (Covid-19) in the United States:
This map is based on the data compiled from covidtracking.com, partly because it has a good API and also lists testing, cases and deaths. The data I’ve included on the map is:
Each of these is also calculated per 100,000 population in the state:
These latter metrics are important because numbers of cases or deaths can be obscured by small or large populations but per capita data (or per 100k capita data) can point out interesting outliers.
It is important to note that the data is far from perfect. There is probably significant underreporting of tests, cases and deaths. The data is a collection for the various local and state agencies that are working hard to deal with the medical, social and political ramifications of the pandemic, while also collecting data. We don’t know how many Americans have coronavirus because of lack of testing.
Also important is that the number of positive cases is a function of how much testing is taking place so cases does not necessarily represent the exact prevalence of the virus, though there will probably be good correlation between cases and actual coronavirus infections. Luckily it sounds like tests are becoming more widely available so hopefully those numbers will go up sharply.
For more information about the virus and the disease and data collection, you can find good information on the CDC website.
Sources and Tools:
Coronavirus cases are obtained from covidtracking.com. And the visualization was created using javascript and the open source leaflet javascript mapping library.
function resizeMapFrame(){ //this function is called from the javascript from within the iframe after the contents of iframe are loaded (and after an additional 150ms delay) setTimeout(function (){ mm = document.getElementById('mapframe'); mm.height = mm.contentWindow.document.body.scrollHeight+60+"px"; console.log("resize");
}, 150); }
function reloadiframes(){ document.getElementById('mapframe').contentWindow.location.reload(); }
window.addEventListener("orientationchange", function() { reloadiframes(); resizeMapFrame(); }, false);
The interface has been updated and you can now also zoom in and look at a specific state’s election results.
Click here to view a visualization that looks more explicitly at the correlation between population density and votes by county.
This interactive map shows the election results by county and you can display the size of counties based on their land area or population size.
Previously, I created a map (cartogram) that showed the state by state electoral results from the Presidential Election by scaling the size of the states based on their electoral votes. The idea for that map was that by portraying a state as Red or Blue, your eye naturally attempts to determine which color has a greater share of the total. On a normal election map, Red states dominate, especially because a number of larger, less populated states happen to vote Republican. That cartogram changed the size of the states so that large states with low population, and thus low electoral votes tended to shrink in size, while smaller states with moderate to larger populations tended to grow in size. Thus, when your eyes attempt to discern which color prevails, the comparison is more accurate and attempts to replicate the relative ratio of electoral votes for each side.
This map looks at the 2020 and 2016 presidential election results, county by county. An interesting thing to note is that this view is even more heavily dominated by the color red, for the same reasons. Less densely populated counties tend to vote republican, while higher density, typically smaller counties tend to vote for democrats. As a result, the blue counties tend to be the smaller ones so blue is visually less represented than it should be based on vote totals. More than 75% of the land area is red, when looking at the map based on land areas, while shifting to the population view only about 46% of the map is red. Neither of these percentages is exactly correct because each county is colored fully red or blue and don’t take into account that some counties are won by a large percentage and some are essentially tied. However, the population number is certainly closer to reality as Trump won about 48.8% of the votes that went to either Trump or Clinton.
This tool should be relatively straightforward to use. Just click around and play with it.
The map has a few different options for display:
This was my second attempt at using d3 to generate visualizations. I typically use leaflet to do web-based mapping but I wanted the power of d3 which has functions for the circles to prevent overlapping. This map was inspired by Karim Douieb’s cool visualization of 2016 election results. I modified it in a number of different ways to try to make it more interactive and useful.
This visualization does not actually simulate the collisions between the circles on your browser. It is a bit computationally taxing and causes my computer fan to turn on after awhile. So instead I ran the simulation on my computer and recorded the coordinates for where each circle ended up for each category. Then your browser is simply using d3 transitions to shift positions and sizes of the circles between each of the maps, which is simpler, though with 3142 counties, it can still tax the computer occasionally.
Data and Tools
County level election data for 2016 is from MIT Election Lab. The 2020 county level data is downloaded from the New York Times county election data API and processed using a python script. Population data used is for 2018. The visualization was created using d3 javascript visualization library.
function resized3map(){ //this function is called from the javascript from within the iframe after the contents of iframe are loaded (and after an additional 150ms delay) setTimeout(function (){ mm = document.getElementById('mapframe'); mm.height = mm.contentWindow.document.body.scrollHeight+20+"px"; console.log("resize"); mobilewarn();
}, 150); }
function reloadiframes(){ document.getElementById('mapframe').contentWindow.location.reload(); }
window.addEventListener("orientationchange", function() { reloadiframes(); resizemap(); }, false);
Recent Comments