# Posts for Tag: population

### US County Electoral Map – Land Area vs Population

Posted In: Maps | Uncategorized | Voting

#### County-level Election Results from 2016

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.

A little while ago, I made a map (cartogram) that showed the state by state electoral results from the 2016 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 of the 2016 Election, 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 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.

#### Instructions

This tool should be relatively straightforward to use. Just click around and play with it.
The map has a few different options for display:

• Hide Circles – just shows the county map
• Show land circles – where the area of the circle matches the area of the county itself, though obviously shaped like a circle. The counties are colored red or blue depending on whether Trump or Clinton won more votes in that county.
• Show population circles – where the area of the circle matches the relative population of the county itself. More populated counties will grow larger while less populated counties will shrink. The counties are colored red or blue depending on whether Trump or Clinton won more votes in that county.
• Selecting the No County Overlap checkbox will spread out all of the circles so you can see them all. The total displayed area of the county circles is the same in either land and population view, though if the circles are overlapping, you may see less total colors.

#### Visualization notes

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 is from MIT Election Lab. Population data used is for 2018. The visualization was created using d3 javascript visualization library.

### Assembling the USA state-by-state with state-level statistics

Posted In: Maps

#### Watch the United States assemble state by state based on statistics of interest

Based on earlier popularity of the country-by-country animation, this map lets you watch as the world is built-up one state at a time. This can be done along a large range of statistical dimensions:

• Name (alphabetical)
• abbreviation
• Date of entry to the United States
• State Population (2018)
• Population per Electoral Vote (2018)
• Population per House Seat (2018)
• Land Area (square miles)
• Population Density (ppl per sq mi) (2018)
• State’s Highest Point
• Highest Elevation (ft)
• Mean Elevation (ft)
• State’s Lowest Point
• Lowest Point (ft)
• Life Expectancy at Birth (yrs)
• Median Age (yrs)
• Percent with High School Education
• Percent with Bachelor’s Degree
• Residential Electricity Price (cents per kWh) (2018)
• Gasoline Price ($/gal) Regular unleaded (2019) • State Gross Domestic Product GDP ($Million) (2018)
• GDP per capita (\$/capita)
• Number of Counties (or subdivisions)
• Average Daily Solar Radiation (kWh/m2)
• Birth rate (per thousand population)
• Avg Age of Mother at Birth
• Annual Precipitation (in/yr)
• Average Temperature (deg F)
• These statistics can be sorted from small to large or vice versa to get a view of the US and its constituent states plus DC in a unique and interesting way. It’s a bit hypnotic to watch as the states appear and add to the country one by one.

You can use this map to display all the states that have higher life expectancy than the Texas:
select “Life expectancy”, sort from “high to low” and use the scroll bar to move to the Texax and you’ll get a picture like this:

or this map to display all the states that have higher population density than California:
select “Population density, sort from “high to low” and use the scroll bar to move to the United States and you’ll get a picture like this:

I hope you enjoy exploring the United States through a number of different demographic, economic and physical characteristics through this data viz tool. And if you have ideas for other statistics to add, I will try to do so.

Data and tools: Data was downloaded from a variety of sources:

• Population https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States_by_population
• Educational attainment https://nces.ed.gov/programs/digest/d18/tables/dt18_104.88.asp
• Highest points https://geology.com/state-high-points.shtml
• Life expectancy https://en.wikipedia.org/wiki/List_of_U.S._states_and_territories_by_life_expectancy
• Median Age http://www.statemaster.com/graph/peo_med_age-people-median-age
• Land area https://statesymbolsusa.org/symbol-official-item/national-us/uncategorized/states-size
• Mean elevation https://www.census.gov/library/publications/2011/compendia/statab/131ed/geography-environment.html
• Electricity price https://www.chooseenergy.com/electricity-rates-by-state/
• Gasoline price https://gasprices.aaa.com/state-gas-price-averages/
• GDP https://www.bea.gov/data/gdp/gdp-state
• Sunlight North America Land Data Assimilation System (NLDAS) Daily Sunlight (insolation) for years 1979-2011 on CDC WONDER Online Database, released 2013. Accessed at http://wonder.cdc.gov/NASA-INSOLAR.html on Jun 14, 2019 1:37:15 PM
• Births United States Department of Health and Human Services (US DHHS), Centers for Disease Control and Prevention (CDC), National Center for Health Statistics (NCHS), Division of Vital Statistics, Natality public-use data 2007-2017, on CDC WONDER Online Database, October 2018. Accessed at http://wonder.cdc.gov/natality-current.html on Jun 14, 2019 1:53:58 PM
• Precipitation North America Land Data Assimilation System (NLDAS) Daily Precipitation for years 1979-2011 on CDC WONDER Online Database, released 2013. Accessed at http://wonder.cdc.gov/NASA-Precipitation.html on Jun 26, 2019 3:30:40 PM
• Temperature http://www.usa.com/rank/us–average-temperature–state-rank.htm

The map was created with the help of the open source leaflet javascript mapping library

### Assembling the World Country-By-Country

Posted In: Maps

#### Watch the world assemble country-by-country based on a specific statistic

This map lets you watch as the world is built-up one country at a time. This can be done along the following statistical dimensions:

• Country name
• Population – from United Nations (2017)
• GDP – from United Nations (2017)
• GDP per capita
• GDP per area
• Land Area – from CIA factbook (2016)
• Population density
• Life expectancy – from World Health Organization (2015)
• or a random order

These statistics can be sorted from small to large or vice versa to get a view of the globe and its constituent countries in a unique and interesting way. It’s a bit hypnotic to watch as the countries appear and add to the world one by one.

You can use this map to display all the countries that have higher life expectancy than the United States:
select “Life expectancy”, sort from “high to low” and use the scroll bar to move to the United States and you’ll get a picture like this:

or this map to display all the countries that have higher population density than the United States:
select “Population density, sort from “high to low” and use the scroll bar to move to the United States and you’ll get a picture like this:

I hope you enjoy exploring the countries of the world through this data viz tool. And if you have ideas for other statistics to add, I will try to do so.

Data and tools: Data was downloaded primarily from Wikipedia: Life expectancy from World Health Organization (2015) | GDP from United Nations (2017) | Population from United Nations (2017) | Land Area from CIA factbook (2016)
The map was created with the help of the open source leaflet javascript mapping library

### World Population Distribution by Latitude and Longitude

Posted In: Maps

#### How is population distributed by latitude and longitude

This interactive map shows how population is distributed by latitude or longitude. It animates the creation of a bar graph by shifting population from its location on the map to aggregate population levels by latitude or longitude increments. Each “block” of the bar graph represents 1 million people. Population is highest in the northern hemisphere at 25-26 degrees North latitude and 77-78 degrees East Longitude.

#### Instructions:

It should be relatively explanatory. Press the “Aggregate Population by Latitude” button to make a plot of population by line of latitude (i.e. rows of the map).
Press the “Aggregate Population by Longitude” button to make a plot of population by line of longitude (i.e. columns of the map). To see the population distributed across the map, press the “Show Population Grid” button.

This map was inspired by some mapping work done by neilrkaye on twitter and reddit.

Data Sources and Tools:
This map projection is an equirectangular projection. Data on population density comes from NASA’s Socioeconomic Data and Applications Center (SEDAC) site and is displayed at the 1 degree resolution. This interactive visualization is made using the awesome leaflet.js javascript library.