Visualization Overview

Author

Andreas Handel

Modified

2024-03-20

Overview

In this unit, we will discuss visualization (a.k.a. making figures), what they are good for, and how to do them in R.

A comic from the website XKCD. It shows an extremely confusing and illogical flowchart which includes a line chart, a battery charging circuit, a resistance diagram, a golden spiral, and an arrow that leads out of the containing box, among other things.

Flowcharts are sometimes, but not always good visualization tools. Source: xkcd.com.

Objectives

  • Understand when and how to use graphs.
  • Become familiar with major types of graphs and when to use them.
  • Learn how to implement high-quality graphs in R.

Motivating Examples

The topic of visualization is enormous, and impossible to cover thoroughly in a week (like pretty much any topic we talk about in this course 😃). To get you started, the two following TED talks provide some examples of interesting and inspiring data visualizations.

In the first video Mona Chalabi talks about good ways to present data and statistics and how good graphs can help in understanding.

In the second video Chris Jordan discusses how one can take abstract facts and make them much more tangible through visualization.

If you are interested, you can find more interesting talks on visualization in this TED topics site and this TED Studies collection.

Visualization uses

Figures and graphs are useful at any stage of your analysis. Use them early to explore your data, to get an idea for what you have, to figure out what cleaning you might need to do, and to check what analysis approaches might be useful. Use visualizations once you have done your analysis to check your results and interpret them. Use them at the end to communicate your results. While tables can be useful tools of communication as well, they tend to be much harder to understand and are – in my opinion – overused in science. Good figures are, most of the time, easier to understand and a more effective way to look at data.

Types of graphs

I am sure you are familiar with several common types of graphs, such as scatter plots, boxplots, and bar charts. Many more chart types exist, some are much better at conveying potentially complex information than the simple standard ones. An excellent resources is the From Data to Viz website. It lists a lot of different graphs based on the kind of data you want to plot, and for each graph it gives a brief description and often a link to the R Graph Gallery which shows examples with code. Sometimes you start with data and are looking for the best way to plot it. Other times you see a great graph and want to know what it is called. These 2 websites are great resources for either situation.

Another great source that provides an overview of different graphs is the Directory of Visualizations chapter of the excellent Fundamentals of Data Visualization book by Claus Wilke. Further chapters in his book describe specific types of plots in more detail, and also provide general best practices for making plots. If you are interested in specific types of plots and general concepts of visualization, skim through his book.

Further visualization resources

See the General Resources page for some additional sources.