The data in this interactive graphic comes primarily from the Centers for Disease Control and Prevention’s Multiple Cause of Death database, which is derived from death certificates from all 50 states and the District of Columbia and is widely considered the most comprehensive estimate of firearm deaths. In keeping with the CDC’s practice, deaths of non-U.S. residents that take place in the U.S. (about 50 per year) are excluded. All figures are averages from the years 2012 to 2014, except for police shootings of civilians, which are from 2014.

The “homicides” category includes deaths by both assault and legal intervention (primarily shootings by police officers). “Young men” are those ages 15 to 34; “women” are ages 15 and older. Because the CDC’s estimates of police shootings are unreliable, we used estimates from non-governmental sources. Our figure is for 2014, the first year for which such estimates are generally available. (For more on the data we used, see Carl Bialik’s story on police shootings.)

For shootings of police officers, we used the FBI’s count of law enforcement officers “feloniously killed” by firearms in the line of duty. This figure excludes accidental shootings. The FBI counts all killings of federal, state and local law enforcement officers who meet certain criteria, including that they were sworn officers who ordinarily carried a badge and a gun.

For mass shootings, we used Mother Jones’s database of public mass shootings. For 2012 and earlier, Mother Jones includes only incidents in which at least four people (excluding the shooter) were killed; beginning in 2013, Mother Jones lowered the threshold to three fatalities. In order to use a consistent definition, we excluded the one incident in 2013-14 in which exactly three people were killed.

For terrorism gun deaths, we used the University of Maryland’s Global Terrorism Database. Our count of fatalities excludes perpetrators killed during their attacks. There was one incident, the 2012 attack on a Sikh temple in Oak Creek, Wisconsin, that qualified as both an act of terrorism and a mass shooting. Seven law-enforcement officers were killed in incidents that the terrorism database classifies as acts of terrorism.

Population totals (used to calculate death rates per 100,000 people) are based on 2012-14 American Community Survey microdata from the University of Minnesota’s IPUMS project. As a result, death rates will not perfectly match official figures from the CDC, which are based on a different set of numbers from the Census Bureau. Racial and ethnic categories are mutually exclusive: All people who were designated as Hispanic in the CDC data are coded as “Hispanic” in ours; all other racial categories are non-Hispanic. “Native American” includes American Indians and Alaska Natives.