16. Data Visualization

"Above all else, show the data." - Edward Tufte

Lesson Prerequisites

This lesson assumes that you have basic knowledge of Stata syntax and writing code in .do files (Intro to Stata, Stata Best Practices).

0. Intro to the lesson

A good data visualization can be the difference between a decisionmaker understanding and acting on the data versus your report being unread and shoved into a file drawer.

1. Principles of Data Visualization

Tufte gives us key concepts in data visualization, including the Lie Factor, the Data-Ink Ratio, and chartjunk.

2. Tips for Graphing in Stata

Don’t compromise your vision because it is easier to use default Stata visual elements or graph types. You should create the graph that you want to create. It’s just a fun puzzle to figure out the syntax to do this.

3. Stata Graph Basics (1)

I introduce the basic twoway graph in Stata and show how to add options to the graph, including changing titling and axis labels.

4. Stata Graph Basics (2)

I show how to add multiple graphs to the same canvas, how to style the legend, and how to change the overall styling of the graph with different schemes and fonts.

5. Overlaying Graphs

Fitted lines visually highlight the relationship between two variables, while confidence intervals show the precision of fitted estimates. I also demonstrate how to add reference lines and text to graphs.

6. Bar Graphs

Bar graphs are one of the most common types of graphs, but somewhat tricky to customize in Stata. I show how to create bar graphs with confidence intervals.

7. Other Graphs

Connected line graphs and distribution plots (like histograms and kernel density graphs) are other common graph types for M&E applications. You can combine graphs into the same image, and export any image to PDF, PNG, or other file types.

Additional Resources

  • IDinsight Data Viz Library (link)

  • IDinsight Technical Report Template (link)

  • IDinsight Technical Report Checklist (link)

  • Top 25 Stata Visualizations with Code (link)

  • UCLA's Institute for Digital Research and Education Stata Graphics Learning Modules (link)

  • WTF Visualizations (link)

Banner photo: Charles Minard's map of Napoleon's 1812 Russia campaign, an early and stunning example of a Sankey diagram. Accessed from https://en.wikipedia.org/wiki/Charles_Joseph_Minard#/media/File:Minard.png