Apps and Data

Everything the book uses is listed here. The apps run in the browser and need no account. The data files are the ones the chapters load. The scripts that built them from their public sources are in the same repository. The code behind every figure is under a “Show the code” fold on the chapter page.

Apps

Each app is built in R with Shiny. The App column opens the copy on a Shiny server, which starts in a second or two. The Browser column opens a copy that runs inside your browser with no server. It takes a few seconds to start and works offline once loaded. The browser copies are also listed at https://viz.marginoferrormedia.com/apps.

Chapter App Browser What it lets you do
1 Datasaurus Explorer browser Switch among thirteen datasets with the same summary statistics and compare their shapes
1 Child Mortality, Four Ways browser Pick countries, years, and a question, and redraw the world line, region panels, slope chart, or strip plot
2 Perception Lab browser Run the Cleveland and McGill experiment on yourself and draw your own hierarchy of encodings
3 Chart Autopsy browser Pick the question that exposes the problem in a chart, then see the corrected chart
4 Same Data, Six Charts browser Draw one year of refugee data six ways and see which question each chart answers best
5 Shape of a Variable browser Change bin width, grouping, and the unit of counting, and see the city ridge shift from 41 to 14 percent
6 Two Variables browser Choose axes, size, and highlight for the majors data, and remove any one major to see the correlation change
7 Time and Base browser Switch counts, rates, and an index, move the base year, and compare which states appear to grow
8 Same Place, Four Maps browser Compare a quantile choropleth, an equal-interval choropleth, proportional symbols, and a tile grid, with the class count on a slider
9 Finish This Chart browser Take the default trust chart to a finished one, with grayscale and deuteranopia views below it
10 Give or Take browser Set a sample size and a true margin, draw one poll or a hundred, and add a systematic lean
11 Service Gaps browser Move the two thresholds on the nonprofit dashboard and decide what number belongs in the tile
12 Data to Story browser Pick any country and build the peer group, the gap, the age check, and the three-panel story, then mark the model’s caption

Data

Every file below is a comma-separated text file, except the county boundaries, which are GeoJSON. Each loads directly from this site, so the chapter code runs as written. The scripts in data-raw/ document each source and every step from the original download to the file here. Every file contains real data. None is simulated.

Chapter File Contents Source
1 ch01-world-under5-since-1800.csv Share of children dying before age five, world, 1800 to 2017 Gapminder and World Bank, via Our World in Data
1 ch01-under5-by-country.csv Under-five mortality per 1,000 live births by country, 1960 to 2017, with region and income group UN IGME, via Our World in Data, and Natural Earth
2 ch02-pm25-exposure.csv Population-weighted PM2.5 exposure by country and year World Bank, via Our World in Data
2 ch02-air-pollution-deaths.csv Deaths attributed to air pollution by country and year IHME Global Burden of Disease and State of Global Air, via Our World in Data
2 ch02-orings.csv O-ring damage and launch temperature for the 23 shuttle flights before Challenger Dalal, Fowlkes, and Hoadley (1989)
3 ch03-us-asylum.csv People of concern to UNHCR hosted by the United States, by year and type UNHCR, via the refugees package and TidyTuesday
3 ch03-hosts-2022.csv Refugees hosted by country, 2022 UNHCR, via TidyTuesday
4 ch04-refugees-world.csv Refugees, asylum seekers, and others of concern by origin, host, and year, 2010 to 2022 UNHCR, via TidyTuesday
5 ch05-school-districts.csv Enrollment, locale, and racial composition for US school districts, 1995 and 2017 NCES Common Core of Data, via TidyTuesday
6 ch06-college-majors.csv Earnings, employment, and gender share for 172 majors American Community Survey 2010 to 2012, via FiveThirtyEight
7 ch07-incarceration-national.csv Jail and prison populations and rates, 1970 to 2016 Vera Institute of Justice, via TidyTuesday
7 ch07-incarceration-state.csv The same by state, with the number of counties reporting each year Vera Institute of Justice, via TidyTuesday
8 ch08-counties.geojson County boundaries with FIPS codes US Census Bureau, via Plotly datasets
8 ch08-county-acs-2015.csv Population, income, poverty, child poverty, and jail rates by county ACS 2011 to 2015, via TidyTuesday
8 ch08-bay-area-rentals.csv Craigslist rental listings with price and location Pennington (2018), via TidyTuesday
9 ch09-trust-us.csv Share of Americans who say most people can be trusted, by survey wave World Values Survey, via Our World in Data
9 ch09-trust-world.csv The same for 98 countries, including the United States World Values Survey, via Our World in Data
10 ch10-polls.csv Poll margins, sample sizes, and results for US races since 1998 FiveThirtyEight pollster ratings
11 ch11-zip-gaps.csv Nonprofit organizations and need by ZIP code in the Inland Northwest Patil (2026), Inland Northwest Nonprofit Sector Intelligence
11 ch11-orgs.csv Organizations with category, revenue, and location The same, from the NCCS Business Master File
11 ch11-county-summary.csv The same summarized by county The same
12 ch12-life-expectancy.csv Period life expectancy at birth by country and year, 1950 to 2021 UN World Population Prospects and Human Mortality Database, via Our World in Data and TidyTuesday
12 ch12-life-expectancy-ages.csv Remaining life expectancy at birth and at ages 25, 45, and 65 The same

The full set is at https://github.com/patilv/patilv-books/tree/master/book5-viz-analytics/data.

Reading the Code

The R in this book uses ggplot2 and the tidyverse. A reader new to R can start with Run the Numbers at https://r.marginoferrormedia.com, which is free and which has a reproduce page for every figure in this book. The shared theme behind every figure, mv-theme.R, is in the repository with the data.

Corrections

Errors and suggestions go to github.com/patilv/make-it-visible-feedback or to patilv@gmail.com. Each correction is credited in the next printing.