Posts for Tag: visualization

Tracking US Coronavirus Cases by State

Posted In: Maps

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, partly because it has a good API and also lists testing, cases and deaths. The data I’ve included on the map is:

  • Numbers of coronavirus cases – i.e. tested positive for virus
  • Numbers of coronavirus tests administered
  • Numbers of deaths due to coronavirus

Each of these is also calculated per 100,000 population in the state:

  • Numbers of coronavirus cases per 100k people- i.e. tested positive for virus
  • Numbers of coronavirus tests administered per 100k people
  • Numbers of deaths due to coronavirus per 100k people

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 And the visualization was created using javascript and the open source leaflet javascript mapping library.

coronavirus by state

Mapping US Cities By Name

Posted In: Geography | Maps

This map of the United States visualizes over 28,000 cities in the 50 states. The interactive visualization lets you type in a name (or part of a name) and see all of the cities that contain those string of letters. The points on the map show the geographic center of each city.

For example, if you type in “N”, you will highlight all cities that start with an N in the US. As you type in another letter (e.g. “e”, it will narrow down the cities that begin with those two letters (“Ne”). It will progressively narrow down the number of cities as you type in more letters. You can see an scrollable list of the cities (ordered by city population) that contain the string of letter that you have typed.

If you hover over a highlighted city, you can see the name of the city.

You can click on the check box to show or hide the outlines of the states.

You can “Show City List” to show the list of cities that contain the string of letters you have typed.

Sources and Tools:

City name and location data was downloaded from And the visualization was created using javascript and the open source leaflet javascript mapping library.

US city names

Planetary Art – Inner Planet Orbital Spirograph

Posted In: Fun


Earlier, I had made a visualization showing that Mercury is the closest planet to Earth (on average) and not Venus or Mars. To make that, I downloaded a bunch of NASA ephemeris (orbital) data. I realized I could use the same data to make some cool orbital art inspired by a spirograph – a planetary spirograph.

Basically, you get to choose a planet and the visualization will draw a line connecting that planet and Earth every few days. These lines will then build up into a cool pattern over 40 earth years of orbital cycles. Each planet (Mercury, Venus and Mars) has a different orbital period around the sun than Earth does and as a result, interesting patterns emerges.

Orbital periods of the four inner rocky planets:

  • Mercury: 88 days
  • Venus: 225 days
  • Earth:365 days
  • Mars: 687 days

Also evident is that the orbits of some of the planets are not quite circular so the pattern isn’t quite centered on the sun. Venus has the most regular pattern, creating a distinctive 5-lobed design. The other planets also have visually stunning patterns, though they do not repeat perfectly over time.

You can change the planets using the drop down menu as well as change the speed of the spirograph, and hide the planets and the sun.

Data and Tools:
I had thought about simulating the planets but there are plenty of tools out there that generate this orbital data so instead just downloaded 40 years of ephemeris data (data related to positions of astronomical bodies) from NASA website.. I processed the data using javascript and drew the picture using HTML canvas tools.

Planetary Art Spirograph

How do Americans Spend Money? US Household Spending Breakdown by Household Composition

Posted In: Money
spending by household composition


How much do US households spend and how does it change with household composition?

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 marital status and presence of children in the household.

This visualization focuses on how spending varies with the household composition (marital status and presence of children).

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
    • Single person households (and other households) – Unfortunately BLS lumps single households with other categories that don’t fit into the remaining three categories (i.e. non-married couple households).
    • Single parent households
    • Married couples with no children
    • Married couples with children

The composition of households and income change as the marital status of and presence of children in the household 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 the larger the number of children and adults in the household. Married couples with children have the highest incomes and greatest spending, but they also save the most money.

Households with a single occupant (and also single parent households) have lower incomes than married couples and on average need to borrow or draw down on savings to live their lifestyle.

How does your overall spending compare with those that have the same household composition 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 2017 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 household composition

Cumulative CO2 emissions calculator

Posted In: Environment
CO2 emissions

Facebooktwittergoogle_plusredditpinterestlinkedinmailCO2 emissions are the primary contributor to our current ‘climate crisis’. Because of buildup of heat-trapping nature of CO2 and other greenhouse gases in the atmosphere, temperatures are rising and weather and precipitation patterns are changing. Changes in climate will have profound impacts on both natural systems and our human landscapes.

Significant emissions of CO2 really started in the industrial revolution. This is when humans really started using significant quantities of non-renewable energy sources, mainly fossil fuels such as coal and later natural gas and oil. The increase in the burning of hydrocarbon energy sources for powering factories and transportation lead to growing CO2 emissions. The following graph shows the annual emissions of CO2 since 1750, before the start of the industrial revolution. In this period of 269 years, humans have emitted 1600 billion tonnes of CO2 (1600 gigatonnes). One incredible fact is that due to rapid growth in population and energy use per capita over time, we are emitting more and more CO2 each year and that humans have emitted as much in the last 28 years than in the 240 years prior to that.

Calculate CO2 emissions since <insert date>



  • The interactive visualization lets you enter any year between 1750 and 2017 and it will show the relative proportion of human CO2 before and after that year.
  • You can also use the left and right arrow keys to change the year up and down
  • If you hover over the graph you can see the annual and cumulative emission for each individual year in the graph
  • If you want to share the visualization with a specific year highlighted, you can add the following to the URL “?yr=yyyy” where yyyy is the four digit year (e.g.


    The global median age is around 30 years old (i.e. half the people on earth were born after 1989). This means that more than half of the earth’s population has seen the global cumulative CO2 emissions double in their lifetime. Also very striking is that in my children’s lifetimes (around a decade), humanity has added nearly 1/5 of all human produced CO2 ever to the atmosphere.

    Notes: Emissions are in units of gigatonnes of CO2. To convert to gigatons of carbon, another common unit of measuring carbon emissions, divide by 3.666.

    Data source and Tools
    Annual emissions data is from the Global Carbon Project. The data is processed in javascript and plotted using the open-source, javascript plotting library, Plotly.

    Historical CO2 emissions

  • Where on Earth is all the water? From the solar system to living things

    Posted In: Science | Water

    Facebooktwittergoogle_plusredditpinterestlinkedinmailEarth is known as the blue planet, because it’s covered with quite a bit of water. But do you know where all that water on Earth is located? This interactive visualization will show the various amounts of water in its many forms on Earth: Oceans, Lakes, Rivers, Ice, Groundwater, etc….

    If you hover over a part of the circular, sunburst graph, it will show you the amount of water that is in each of the various forms shown. If the label for that form is bolded, you can click on it and see further subdivisions beyond that broad category. For example, if you click on Oceans, it will show you how the water in the oceans is distributed among the five main oceans on Earth. As you move towards more focused views on the graph, you can click on the center of the circle to move back out to larger categories and see the big picture again.

    As you can see, most of the water on Earth is found in a salty form, and most of that is in the oceans. It can be hard to click through to see freshwater lakes and rivers, as you have to be very precise to expand the “Surface Water” wedge, when you are looking at all “Freshwater”.

    Even smaller, on that same visualization, is the “Living things” wedge is basically invisible. You can further explore the details of the living things category by clicking on the button that appears on the freshwater graph.

    Checking the Group Rivers and Lakes checkbox will group rivers by continent and lakes by major groups.

    It is interesting to see how much water there is on Earth (about 1.4 billion cubic kilometers of water), but how little of it is non-salty, liquid freshwater at the surface (about 100,000 cubic kilometers, though that is still quite a lot) but it only makes up about 0.008% of all water on Earth. That means for every 10,000 gallons of water on Earth, only one of those gallons is freshwater in a lake or river that we can easily access.

    It is also believed that there is more water deep in the Earth’s interior (i.e. the mantle) than on the surface or near-subsurface, but estimates of that are highly uncertain and are not included in this graph.

    If you click out past Earth’s water to look at water in the solar system, the estimates shown in this visualization are only including liquid water and do not include estimates of ice (which I haven’t been able to find estimates of). The amount of water in living things is estimated assuming that the ratio of organic carbon to liquid water is more or less the same across all different types of living things (i.e. viruses, bacteria, fungi, plants, animals, etc.). This isn’t a great assumption but the estimates, which come from estimates of the dry carbon weight of these organisms, vary across many orders of magnitude so being off in liquid water weight/volume by a factor of two or so isn’t a huge problem.

    Tools and Data Sources
    The sunburst chart is made using the open source, javascript graphing library. Data on water distributions is primarily from Wikipedia – Distribution of WaterList of Rivers by DischargeList of Lakes Weight of Living BiomassExtra-terrestrial water estimates

    water on earth