Chapter 11 Interactive Graphics
11.1 Introduction
Much of the discussion up to this point has focused on traditional, static graphs. But the digital transmission of nearly all content makes it possible to provide users with an interactive experience with the data. This will allow non-technical people to interact with the data and ask question that interest them. By allowing people to interact with the data at their own pace, they gain a much deeper understanding of the relationships the graphics are trying to present.
One reason that people get more out of an interactive experience is because they just spend longer looking at the graph. Once you give somebody the option of fiddling with a slider, they spend more time processing exactly what the variable is that they are affecting. If you give them a choice of y-axis values, they’ll spend longer considering each one and which one they actually want to look at. In this sense, an interactive display forces the reader to slow down and really think about the graphic.
Second, it allows the reader to ask question that they are interested in. If I see a graph about immigration patterns in Europe, I will likely gravitate to asking about Germany, because I took German in high school and have traveled there. Whoever build the graphic couldn’t have guessed why I care about Germany, but they made it possible for me to dig into the question that I care about.
11.2 Examples
Covid-19 Example
This New York Times opinion article was written to encourage readers to think about the effects of prolonged social-distancing as a mechanism for reducing the harms by this virus. It has two interactive components. The first component only has one interactive piece but it isn’t too overwhelming for the reader. The article then goes on to explain different aspects of the model they built and then gives a similar interactive graphic but now have a ton of different control dials. Finally, the authors give extreme detail to their modeling process and where their data came from.
A history of World Civilizations
History of World Civilizations gives its readers a nice clickable interface to really think about the time-line of different civilizations. History of Civilization courses typically focus on individual civilizations and don’t give context to what was happening contemporaneously in, say, Chinese vs European history. This dashboard tries to address that need.
Rainforest Biodiversity
The Rainforest Biodiversity dashboard tries to give readers an insight into just how much biodiversity exists in various. Ultimately this graphic feels there is not a deliberate story the author is trying to tell, but rather an invitation for the reader to look around.
Women in Politics
Taxi Rides in NYC
In this graphic, we see the number of taxi rides in New York City broken up across time points and across the days of the week. The graphic invites the reader to first consider how the time of day (the top bar chart) and then secondarily how that changes across the days of the week.
In particular I like that this graphic finally addresses the question, “Is Thursday night a party night?” Judging by the taxi ride data, there are fewer people riding late at night compared to Friday or Saturday, but the ride numbers are different than midweek.
11.3 Deeper Thoughts
It is tempting to think of interactive graphics as either:
- A method to get viewers to interact and therefore pay attention.
- A shiny whiz-bang doodad that is fun to fiddle with.
But it is more subtle than that. By giving the reader some toggles to play with, we often allow them to change the level of focus. I like to think of the metaphor of looking at a forest/tree at several different distances. At an extreme close up, all we can see is the color and ridge pattern that define the bark. As we step back we see the trunk girth. Even farther back and we start to see the branch patterns and then the tree height. Finally moving even farther back we see how the tree is integrated into the surrounding environment. There are interesting questions to ask at each level of focus, and we need to provide a tool that allows an easy exploration of different levels of focus.
11.3.1 Geographic Aggregation Level
Aside from their use when out of your technology is out of power, paper maps are incredibly limited because you have to decide on the map scale when you buy it. But when we use the map, you are constrained to just this scale. When interactive, mobile mapping applications became widespread, the limitations of static maps became obvious. When I plan a cross-country trip, I want to see both the national level information as well as block level information as I am navigating to a hotel.
For most mapping applications, the interaction is to choose the level of resolution about a certain question. At a high level view, most of the information known by the application is actually hidden from view and only a limited amount of information is displayed. Once we start zooming into map, more details are shown, but at each level, the amount of data shown is usually pretty consistent. By zooming in and out of resolution, we keep the big picture in mind while allowing us to dig into as much detail as you want or need.
On a technical note, there are twenty zoom levels with 1 being the world level and 20 being the building scale level.
11.3.2 Miscellaneous Aggregation Levels
There are many real-world examples where we want to be able to shift between different levels of detail. Similarly to the maps, want to keep the amount of information given at each zoom level understandable.
Bruce Springstein’s History In this graphic we can look at the album level or using hover text over individual songs. Similarly the reader can investigate which band members played on which album and the band size. The hover text goes into a great deal of detail, while the grouping structure makes it easy to see trends.
The Beatles In a similar graphic, we can see the song-writing attribution of the top 100 songs by the Beatles. In this graphic it is interesting to see how John Lennon and Paul McCartney initially worked together and before primarily writing separately.
11.3.3 The “Me” Layer
Viewers tend to be very self-centric and a goal of most any story or analysis should be to explain how the topic affects the reader. By allowing a user to interact with and ask how does this affect:
- Somebody like me.
- My favorite team.
- My state/town.
Examples: a) NFL Elo Ratings b) The Birthday Problem
11.4 Tableau Example
Below is a YouTube video walking through the steps of making the dashboard.
For our example, we are going to create a graph that shows the spatial expansion of the coranoa Virus across the United States as well as the exponential growth in cases. We would also like to be able to compare different regions growth rates in the number of cases as well as the number of cases per capita or per 100,000 individuals.
To do this, we’ll need one chloropleth map of county level corona virus cases by date as well as county level information about population sizes.
11.4.1 Data
I got county level corona virus data from the Johns Hopkins github site. In their data directory they have time series data for the counties. To get the county population numbers, I went to the US Census Bureau.
Before we can join the Census data and the Covid-19 data, we need to align the county names. The issue is that the county names from the US Census Bureau are usually like “Gallatin County, Montana.” However there are some weird alternatives to counties such as “Parish,” “Borough,” “Census Area,” “Municipality,” and “city.” So to handle that, we’ll split the counties on the comma and then remove the “County,” “Parish,” etc. Finally we can calculate the rate of infections as the number of infections per 100,000 people.
11.4.2 Tableau
We need to first make two graphs. A chlrolopleth map for the number of cases and a line chart with date and number of cases. For the map, we’ll create a parameter which controls a filter action that selects which date to show. We also need to force that parameter to be shown and able to be manipulated.
Next we can create a dashboard and place the the map and line chart. The final
thing to add is an Action
that takes a selected region on the map and
uses that as the filter on the line graph.
11.5 Exercises
- From the
data-raw
directory of the note github, I have a sub-directory for the Covid-19 information.- Download the files:
Data_a_Data_a_time_series_covid19_confirmed_US_2021_3_14.csv
,Data_b_US_County_Population_Estimates.xlsx
, which give the cumulative confirmed Covid 19 cases in each county by date and the population sizes of each county respectively. The Tableau Prep fileData_c_Cleaning.tfl
combines these and calculates the number of new Covid-19 cases per week. This combinded data is saved into theData_d_****
files that we can work with. Finally you are given a Tableau Desktop fileInteractive_Covid.twb
which creates a dashboard of the number of new cases. - Open the Tableau Desktop file and make sure the data connection is to the file you downloaded.
- In the data, create a calculated column for the number of cases per
100,000 residents. Name this new column
Rate
. - Using the
Map
andTotalCases
graphs as templates, create similar graphs using theRate
column as the response. - Using the
CasesDashboard
as a template, create aRateDashboard
that allows the same date and county/state selection. - Add a
Navigation Object
to each dashboard that, on selection, changes the view to the other dashboard. Note: in the creation mode you have to alt-click to make it switch the view. In display mode, a regular click will do it. The idea is that when a user is actually interacting with the dashboard, that is a different display mode than when you are building it. - Download the latest version of the Covid-19 county level time series data. Utilize the Tableau Prep file to update the data set. Examine the updated visualization.
- To share this dashboard with me, export the workbook as a
Packaged Workbook
. Because workbooks could connect to data that lives in a database, sharing the workbook with others requires some way of capturing a snapshot of the data we use. ThePackaged Workbook
format is the way that Tableau accomplishes that. Export your work as aPackaged Workbook
and upload that to Bblearn for this assignment.
- Download the files: