Basics of Data Visualization

HES 505 Fall 2022: Session 22

Matt Williamson

Objectives

By the end of today you should be able to:

  • Describe some basic principles of data visualization

  • Extend principles of data visualization to the development of maps

  • Distinguish between several common types of spatial data visualization

Introduction to Data Visualization

Telling a story

  • Order of information can evoke emotional connections

  • That reaction helps make your analysis memorable

  • The Shape of Stories

What is a story?

  • Observations, events, facts

  • Told in order to elicit an emotional response

  • Preempt others making up your story

Common story forms

  • Opening → Challenge → Action → Resolution
“Let me tell you a story about the theoretical physicist Stephen Hawking. He was diagnosed with motor neuron disease at age 21—one year into his PhD—and was given two years to live. Hawking did not accept this predicament and started pouring all his energy into doing science. Hawking ended up living to be 76, became one of the most influential physicists of his time, and did all of his seminal work while being severely disabled.”
— Claus Wilke

Common story forms

  • Lead → Development → Resolution
“The influential physicist Stephen Hawking, who revolutionized our understanding of black holes and of cosmology, outlived his doctors’ prognosis by 53 years and did all of his most influential work while being severely disabled…”
— Claus Wilke

Common story forms

  • Action → Background → Development → Climax → Ending
“The young Stephen Hawking, facing a debilitating disability and the prospect of an early death, decided to pour all his efforts into his science, determined to make his mark while he still could…”
— Claus Wilke

Your Turn!!

What do we mean by data visualization?

Principles vs. Rules

  • Lots of examples of good and bad data visualization

  • What makes a graphic good (or bad)?

  • Who decides?

  • Rule: externally compels you, through force, threat or punishment, to do the things someone else has deemed good or right.

  • Principle: internally motivating because it is a good practice; a general statement describing a philosophy that good rules should satisfy

  • Rules contribute to the design process, but do not guarantee a satisfactory outcome

“Graphical excellence is the well-designed presentation of interesting data—a matter of substance, of statistics, and of design … [It] consists of complex ideas communicated with clarity, precision, and efficiency. … [It] is that which gives to the viewer the greatest number of ideas in the shortest time with the least ink in the smallest space … [It] is nearly always multivariate … And graphical excellence requires telling the truth about the data.”
— Edward Tufte

Ugly, Wrong, and Bad

  • Ugly: graphic is clear and informative, but has aesthetic issues

  • Bad: graphic is unclear, confusing, or decieving

  • Wrong: the figure is objectively incorrect

Monstrous Costs’ by Nigel Holmes from Healy 2018

Bad and Wrong

  • Presentation of the data is (intentionally?) decieving

  • Presentation is just incorrect

Tricky (from Healy 2018)

Wrong

Grammar of Graphics (Wilkinson 2005)

  • Grammar: A set of structural rules that help establish the components of a language

  • System and structure of language consist of syntax and semantics

  • Grammar of Graphics: a framework that allows us to concisely describe the components of any graphic

  • Follows a layered approach by using defined components to build a visualization

  • ggplot2 is a formal implementation in R

Aesthetics: Mapping Data to Visual Elements

  • Define the systematic conversion of data into elements of the visualization

  • Are either categorical or continuous (exclusively)

  • Examples include x, y, fill, color, and alpha

From Wilke 2019

Scales

  • Scales map data values to their aesthetics

  • Must be a one-to-one relationship; each specific data value should map to only one aesthetic

Principles of Data Visualization

  • Be Honest

  • Principle of proportional ink

  • Avoid unnecessary ‘chart junk’

  • Use color judiciously

  • Balance data and context

Extending Data Viz to Maps

Telling stories with maps

  • Maps organize a lot of information in a coherent way

  • They invite critique and inspection

  • They are also aesthetic objects that can engage broader audiences

Key Issues

  • Thinking about projections

  • Scale of the map

  • Errors of Omission

Cartographic Principles

  1. Concept before compilation

  2. Hierarchy with harmony (Important things should look important)

  3. Simplicity from sacrifice

  4. Maximum information at minimum cost

  5. Engage emotion to enhance understanding

Common Spatial Visualizations

Choropleth

  • Mapping color to geographies

  • Common problems

From Healy 2019

Cartogram

  • Adjusts for differences in area, population, etc

  • Common Problems

From Healy 2019

Looking ahead

  • Static maps: ggplot2 and tmap

  • Interactive webmaps: leaflet and mapview (maybe others)