19 Advanced graphs

 

This chapter covers

  • Customizing ggplot2 graphs
  • Adding annotations
  • Combining multiple graphs into a single plot
  • Creating interactive graphs

There are many ways to create a graph in R. We’ve focused on the use of ggplot2 because of its coherent grammar, flexibility, and comprehensiveness. The ggplot2 package was introduced in chapter 4, with coverage of geoms, scales, facets, and titles. In chapter 6, we created bar charts, pie charts, tree maps, histograms, kernel density plots, box and violin plots, and dot plots. Chapters 8 and 9 covered graphics for regression and ANOVA models. Chapter 11 discussed scatter plots, scatter plot matrices, bubble plots, line charts, corrgrams, and mosaic charts. Other chapters have covered graphs to visualize the topics at hand.

This chapter will continue the coverage of ggplot2, but with a focus on customization—creating a graph that precisely meet your needs. Graphs help you uncover patterns and describe trends, relationships, differences, compositions, and distributions in data. The primary reason to customize a ggplot2 graph is to enhance your ability to explore the data or communicate your findings to others. A secondary goal is to meet the look-and-feel requirements of an organization or publisher.

19.1 Modifying scales

 

19.1.1 Customizing axes

 

19.1.2 Customizing colors

 
 
 

19.2 Modifying themes

 
 

19.2.1 Prepackaged themes

 
 

19.2.2 Customizing fonts

 
 

19.2.3 Customizing legends

 
 

19.2.4 Customizing the plot area

 

19.3 Adding annotations

 
 
 
 

19.4 Combining graphs

 
 

19.5 Making graphs interactive

 
 
 

Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest