Preface

This book provides an introduction to ggplot2 for interactive data visualization. Its intent is to provide examples of common graphs and basic visualization principles.

Minard’s plot shows the deaths of almost 300,000 troups as they march to Moscow demonstrates the horror of war, and is considered one of the best visualizations ever producced (Tufte 1983). Reasons why this graph is so effect is that it has a clear purpose, it answers important questions with a comples array of data that are presented in an understandable and aesthetically pleasing manner.

Minards visualization of Napoleon's disastrous march to Moscow

FIGURE 0.1: Minards visualization of Napoleon’s disastrous march to Moscow

Why read this book

The aim of this book is help people make more graphs like Figure 0.1). It links principles of graph design to examples that are implemented in R, particularly the popular graphic package ggplot2. The book provides a catalog of graphs and their design rationale organized around general questions that graphs are typically used to answer.

Structure of the book

Chapter 1 introduces R and the tidyverse functions and provides links for learning more about the basic capabilties of R. Chapters 3 - 8 each describe different types of graphs that answer questions regarding association, distribution, comparison, proportion, fluctionation, and connection. Chapter 9 briefly considers graphical elements in tables and Chapters 10 - 11 discuss interactive graphs and adjustments neeed for publication.

Software information and conventions

I used the knitr package (Xie 2015) and the bookdown package (Xie 2019) to compile the book. Most graphs have been created with ggplot2 [@{Wickham2016a] and data manipulation is done with dplyr.

Acknowledgments

B References

Tufte, E. R. 1983. The Visual Display of Quantitative Information. Cheshire, CT: Graphics Press.

Xie, Yihui. 2015. Dynamic Documents with {R} and knitr. 2nd ed. Boca Raton, Florida: Chapman; Hall/CRC. http://yihui.name/knitr/.

Xie, Yihui. 2019. Bookdown: Authoring Books and Technical Documents with R Markdown. https://CRAN.R-project.org/package=bookdown.