36 Cheatsheet of ggplot2 (ggplot2 & alluvial & heatmap)

Yuehan Hu and Wen Chen

36.2 Introduction to ggplot2

ggplot2 is a plotting package that creates complex plots from data based on the grammar of graphics. Moreover, ggplot2 provides a more programmatic interface for specifying what variables to plot, how they are displayed, and general visual properties. This package provides a very convenient way for us to create different kinds of distributions.

36.3 Summary to the Cheatsheet

Our cheatsheet includes three parts, the first part includes the basic definition, some essential grammar and the most common visualizations of ggplot2, which provides us the clearly frame to use standard format and easy way to distinguish the delicate difference between these visualizations. The second part includes the brief description, essential grammar, an example, different curve types, color and legend customizations of ggalluvial. Alluvial is very useful to visualize frequency distributions over time or frequency tables involving several categorical variables. The third part includes a short introduction, an example, color and legend customizations of heatmap. Heatmap is good for us to show relationships between two variables, one plotted on each axis.

36.4 The evaluation of the Cheatsheet

Although there are many similarities in each part of grammar when creating different visualizations, we marked the difference in grey, which help us to distinguish and remember. This cheatsheet summarize some important kinds of visualizations in ggplot2, which also lead us review the content of ggplot2 in this class generally.