Introduction
For my last post I developed a time-lapse choropleth map of Covid-19 confirmed cases and Covid-19-related deaths for the U.S. using data from the New York Times (NYT). While the choropleth map showed the spread of the virus across the U.S. (at least in terms of confirmed cases and deaths), it was difficult for a viewer to obtain detailed data from some smaller counties, and the map did not provide overall state-level counts. Therefore, for this post I wanted to make an interactive bar chart that also showed confirmed cases and deaths from Covid-19 over time, but that provided more detail at both the state and county levels.
This post relies on the same data that were used to develop the choropleth map: the NYT Coronavirus (Covid-19) Data in the United States GitHub repository. This repository contains cumulative Covid-19 confirmed cases and Covid-19-related deaths by state and county, dating back to the first reported Covid-19 confirmed case in Washington State on January 21, 2020. Furthermore, the NYT is updating this repository frequently as new data become available; therefore, this interactive bar chart (and the choropleth map from my previous post) stay up-to-date with the NYT data.
The NYT GitHub repository’s README provides detail on the data files, their methodology, and key definitions (in addition to other information). In addition, the NYT has been tracking the spread of Covid-19 in the U.S. You can view their U.S. tracking page here.
Using the Bar Chart
Before setting you loose on the interactive bar chart, some details are necessary:
- The radio buttons at the top allow you to toggle between confirmed cases of Covid-19 and Covid-19-related deaths. The bar chart and the county-level data (see #3 below) will correspond to your selection.
- The slider is set to the latest date for which data are available by default. You can see the cumulative counts for earlier dates by dragging left, and later dates by dragging right.
- Hovering your cursor over one of the state bars or state names will do two things:
- Show a tooltip displaying the cumulative count of confirmed cases or deaths (depending on your radio button selection) and what fraction of the national total the state represented on the selected date.
- Reveal a list of the counties in the state (to the right of the bar chart) containing the count by county and what fraction of the state total the county represented on the selected date.
- If the “Deaths” radio button is selected: The first reported Covid-19-related death did not occur until February 29, 2020 (1 reported death in Washington State). However, the slider bar still allows you to go all the way back to January 21, 2020 (the date of the first reported Covid-19 case in the U.S.), and the bar chart will continue to list any states that had cases on the selected date, even if a given state had no covid-19-related deaths by that date. This allows you to keep track of which states had confirmed cases, even if no deaths had been reported. As an example, on February 29, 2020 Washington State was the only state with a reported Covid-19-related death; therefore, a bar appears for Washington indicating 1 Covid-19-related death. Moreover, by February 29th nine other states had Covid-19 confirmed cases: AZ, CA, IL, MA, NE, OR, TX, UT, and WI. These other nine states are listed under Washington in the bar plot, but they have no bars showing because there are no Covid-19 related deaths for those states as of February 29th. Similarly, the county-level data will list counties with confirmed cases but no Covid-19-related deaths by the given date.