Posts for Tag: data

How do Americans Spend Money? US Household Spending Breakdown by Education Level

Posted In: Money
How much do US households spend and how does it change with education level?

This visualization is one of a series of visualizations that present US household spending data from the US Bureau of Labor Statistics. This one looks at the education level of the primary resident.

This visualization focuses on the education level of the primary resident. This is defined in the BLS documentation as the person who is first mentioned when the survey respondent is asked who in the household rents or owns the home.

I obtained data from the US Bureau of Labor Statistics (BLS), based upon a survey of consumer households and their spending habits. This data breaks down spending and income into many categories that are aggregated and plotted in a Sankey graph.

One of the key factors in financial health of an individual or household is making sure that household spending is equal to or below household income. If your spending is higher than income, you will be drawing down your savings (if you have any) or borrowing money. If your spending is lower than your income, you will presumably be saving money which can provide flexibility in the future, fund your retirement (maybe even early) and generally give you peace of mind.


  • Hover (or on mobile click) on a link to get more information on the definition of a particular spending or income category.
  • Use the dropdown menu to look at averages for different groups of households based on the education level of the primary resident. This data breaks households into the following groups:
    • All
    • Less than HS graduate
    • High school graduate
    • HS grad + some college
    • Associate’s degree
    • Bachelor’s degree
    • Master’s, professional, doctoral degree

    The composition of households and income change as the education level of the primary resident changes, which in turn affects spending totals and individual categories.

As stated before, one of the keys to financial security is spending less than your income. We can see that on average, income tends to increase with education level. Those with the highest incomes and greatest spending have advanced degrees, but they also save the most money.

The group with the lowest education level (not finishing high school) have the lowest income and on average needs to borrow or draw down on savings to live their lifestyle.

How does your overall spending compare with those that have the same education level as you? How about spending in individual categories like housing, vehicles, food, clothing, etc…?

Probably one of the best things you can do from a financial perspective is to go through your spending and understand where your money is going. These sankey diagrams are one way to do it and see it visually, but of course, you can also make a table or pie chart (Honestly, whatever gets you to look at your income and expenses is a good thing).

The main thing is to understand where your money is going. Once you’ve done this you can be more conscious of what you are spending your money on, and then decide if you are spending too much (or too little) in certain categories. Having context of what other people spend money on is helpful as well, and why it is useful to compare to these averages, even though the income level, regional cost of living, and household composition won’t look exactly the same as your household.

**Click Here to view other financial-related tools and data visualizations from engaging-data**

Here is more information about the Consumer Expenditure Surveys from the BLS website:

The Consumer Expenditure Surveys (CE) collect information from the US households and families on their spending habits (expenditures), income, and household characteristics. The strength of the surveys is that it allows data users to relate the expenditures and income of consumers to the characteristics of those consumers. The surveys consist of two components, a quarterly Interview Survey and a weekly Diary Survey, each with its own questionnaire and sample.

Data and Tools:
Data on consumer spending was obtained from the BLS Consumer Expenditure Surveys, and aggregation and calculations were done using javascript and code modified from the Sankeymatic plotting website. I aggregated many of the survey output categories so as to make the graph legible, otherwise there’d be 4x as many spending categories and all very small and difficult to read.

household spending

What are the highest mountains on Earth? Measuring from sea level vs center of earth

Posted In: Geography

The Highest Mountains On Earth Depend On How You Measure “High”

Mount Everest is famous for being the highest mountain on Earth. The peak is an incredible 8,848 meters (29,029 ft) above sea level. But that is only one way to measure the height of a mountain. Chimborazo, a mountain in Ecuador, holds the distinction for the mountain whose peak is the furthest from the center of the Earth. How is that possible? This is because the Earth is not a perfect sphere. Rather, due to the spinning of the Earth around it’s axis, the centrifugal force causes the equator to bulge out slightly. This flattened shape is called an oblate spheroid and makes the radius of the earth at the equator about 22 km (about 0.3%) larger than the radius to the poles. Mountains close to the equator will “start” further away from the center of the earth, than those at higher latitudes.

This graph plots over 800 of the highest mountains on Earth with their peak height above sea level on the x-axis and their peak distance from the center of the earth on the y-axis. Each point represents one mountain. The colors of the plots correspond to the latitude of the mountain. These mountains range from 3000 meters in height to 9000 meters in height. You can hover over a data point (or click on mobile) to get more information about the mountain. You can also switch from metric to imperial units with the button on the graph.

For a given mountain range at a certain latitude, you can see that as the mountain heights above sea level increases, so does their distance from the center of the Earth. Mountains in the southern hemisphere are colored in blue, those around the equator are green and yellow, and those in the northern hemisphere are red and orange. The mountains with the highest peaks above sea level are shown on the right side of the graph in red and orange (mostly in the Himalaya), with Mt Everest as the right most point on the graph (nearly 9000 meters tall).

Mountains with peaks the greatest distance from the center of the earth are found near the equator in light green/yellow and are found at the top of the graph. You’ll notice that a number of these mountains are higher than Mt Everest when looking at the distance from the center of the earth.

The Himalayas are the “highest” mountains on earth if you are measuring height from sea level, while the Andes are the “highest” if you measure from the center of the earth.


Calculating Distance from Earth’s Center to Mountain Peak

The distance from the center of the Earth is calculated from the following formula:
$$D_{mountain} = H_{mountain} + R_{lat}$$
where $D_{mountain}$ is the distance from center of earth to the top of the mountain, $H_{mountain}$ is the mountain height above sea-level and $R_{lat}$ is the radius of earth at the mountain’s latitude. The height is data that was downloaded from a list of mountain heights.

and the radius of the earth for a given latitude is calculated using the formula:
$$R_{lat}=\sqrt{a^2cos(lat)^2+b^2sin(lat)^2\over acos(lat)^2+bsin(lat)^2)}$$
where $a$ and $b$ are the equatorial and polar radii (6378.137 km and 6356.752 km respectively).

Earth Radius Calculator

Here is a calculator for determining the radius of Earth at a given latitude:

You can use this to calculate the distance from the center of the earth to sea level at your latitude.


Data and Tools:
Data on the heights of over 800 mountain peaks over 3000 meters in height was downloaded from Wikipedia. There ended up being alot of google searching and data cleaning to get it into suitable format for plotting. The calculations were made with javascript and plotted using plotly, the open source javascript graphing library.

Mountain Height Graph

Visualizing The Growth of Atmospheric CO2 Concentration

Posted In: Environment

The current CO2 concentration in the atmosphere is over 400 parts per million (ppm). This has grown about 46% since pre-industrial levels (~280 ppm) in the early 1800s. The growing concentration of CO2 is a big concern because it is the most prevalent greenhouse gas, which is increasing the temperature of the planet and leading to substantial changes in the Earth’s climate patterns.

This graph visualizes the growth in CO2 concentration in the atmosphere (mainly from CO2 emissions due to human activities, such as burning fossil fuels for energy production, deforestation and other industrial processes). The graph starts at 1980 when CO2 concentration in the atmosphere was around 340ppm. It has grown significantly since then.

One of the interesting aspects of CO2 concentration is that it is not identical all around the globe, as it takes awhile for the atmosphere to mix. The graph shows geographic differences in CO2 concentration as well as seasonal ups and downs, that underly an overall growing trend in annual average (mean) concentration.

Seasonal trends in CO2 concentration occur due to differences in the amount of plant growth across different months. Spring and summer plant growth in the northern hemisphere causes a significant amount of photosynthesis, and CO2 absorption, relative to the fall and winter. This plant growth causes a very large amount of CO2 to be absorbed by plants and a noticeable reduction in the amount of CO2 in the atmosphere. The southern hemisphere spring and summer (northern hemisphere fall and winter) aren’t as obvious because there is much less land in the southern hemisphere and the land that is there is close to the tropics and green all year round.

CO2 concentration can change by about 4-5 ppm due to the “breathing” of plants, which is pretty significant. The total weight of CO2 in the atmosphere is about 3 trillion tonnes of CO2, so 4-5 ppm is about 1% of this or 30 billion tons of CO2 removed by plant life each spring/summer.

Data and Tools:

Data comes from the US National Oceanic and Atmospheric Administration (NOAA). Data was downloaded using an automated python script and the graphs were made using javascript and the open-sourced javascript engine.

CO2 concentration graph

How Much Does Each State Pay In Taxes?

Posted In: Money

Given that tax day has just passed, I thought it would be good to check out some data on taxes. The IRS provides a great resource on tax data that I’ve only just gotten into. I think I’ll be able to do more with this in the future. This one looks at how taxes paid varies by state and presents it as a choropleth map (coloring states based on certain categories of tax data).

You can choose from a number of different categories:

  • Mean Federal Tax Paid
  • Mean Adjusted Gross Income
  • Mean State/Local Tax
  • Mean Combined (Fed/State/Local) Tax
  • Percent Income from Dividends and Capital Gains
  • Percent of Returns with Itemized Deductions
  • Number of Tax Returns
  • Mean Federal Tax Rate
  • Mean State/Local Tax Rate
  • Mean Combined (Fed/State/Local) Rate
  • Total Federal Tax Liability

I may add more categories in the future, so if you have ideas of tax data you want to see visualized let me know and I’ll see what I can do.

For other tax-related tools and visualizations see my tax bracket calculator and visualization of marginal tax rates.

**Click Here to view other financial-related tools and data visualizations from engaging-data**

Data and Tools:

Data on tax returns by state is from the IRS website in an excel format. The map was made using the leaflet open source mapping library. Data was compiled in excel and calculations made using javascript.

How much each state paid in taxes

Code Embed: Cannot use CODECSSresize9 as a global code as it is being used to store 2 unique pieces of code in 3 posts

Electric Vehicle Sales By State

Posted In: Energy | Technology

Where are electric vehicles being sold in the United States?

Electric vehicles are any vehicle that can be plugged in to recharge a battery that provides power to move the vehicle. Two broad classes are battery electric vehicles (BEVs) which only have batteries as their power source and plug-in hybrid electric vehicles (PHEVs) which have an alternative or parallel power source, typically a gasoline engine. PHEVs are built so that when the battery is depleted, the car can still run on gasoline and operate like a hybrid vehicle similar to a regular Toyota Prius (which is not plugged in at all).

Electric vehicles (EVs) have been sold in the US since 2011 (a few commercial models were sold previous to that but not in any significant numbers) and some conversions were also available. Since then, the number of EVs sold has increased pretty significantly. I wanted to look at the distribution of where those vehicles were located. What is interesting is that California accounts for around 50% of the electric vehicles sold in the United States. Other states have lower rates of EV adoption (in some cases much, much lower). There are many reasons for this, including beneficial policies, public awareness, a large number of potential early adopters and a mild climate. Even so, the EV heatmap of California done early shows that sales are mostly limited to the Bay Area, and LA areas.

The map shows data for total electric vehicle sales by state for years 2016, 2017 or 2018 and also the number of EV sales per 1000 licensed drivers (this is all people in the state with a drivers license, not drivers of EVs). If you hover over a state, you can see both data points for that state.

It will be interesting to see how the next generation of electric vehicles continues to improve, lower in price and become more popular with drivers outside of early adopters.

Data and Tools:
Data on electric vehicle sales is from the Auto Alliance website. Licensed driver data was downloaded from the US Department of Transportation’s Bureau of Transportation Statistics website. The map was made using the leaflet open source mapping library. Data was compiled and calculated using javascript.

Electric vehicle sales by state

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:
Countries with higher life expectancy than US

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:
Countries with higher population density than US

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