16  Why is data visualization important?

Data is the core of science and a scientist collects, analyses, presents and reports data on a daily basis. Data visualization are an important part of scientific work and it needs to be clear, attractive and convincing [@Wilke2019-qp]. A cleverly constructed data vizualisation can summarise and condense a large amount of information and help to communicate results to the audience.

First, one needs to choose the best type of vizualization, i.e. a figure, a map or a table, to present the data. Second, not every figure is a good figure. The data needs to be presented clear and the main message needs to be convincing. Finally, there are many elements like colour, text size, linetype that can be used to highlight important information. It takes skills to succeed in data vizualization, but you are in the right place to learn more about this.

This chapter on data visualization focuses on the basics of how to vizualize data and communicate scientific results. Figures are not the only tool to vizualize data and we will also touch upon other types, such as maps and tables. We will also give advice for how to make “good” figures and tables, what it takes to write figure or table caption, and how best to present data in a report.

16.1 Data visualisation in R

There are at least three major systems for making figures in R.

  • Base R
  • The lattice package
  • The ggplot2 package

We will focus this tutorial on ggplot2 [@Wickham2011-yw] and associated R packages, as it is generally easier to make nice figures in ggplot2 than the others. We use ggplot2 for figures in our papers.

ggplot2 is a system for ‘declaratively’ creating graphics, based on “The Grammar of Graphics”. You provide the data, tell ‘ggplot2’ how to map variables to aesthetics (x, y, colour, etc), what graphical elements to use, and it takes care of the details.

Contributors

  • Aud Halbritter
  • Richard Telford