Chapter 7. Creating Histograms

In this chapter, we will cover the following recipes:

  • Visualizing distributions as count frequencies or probability densities
  • Setting bin size and the number of breaks
  • Adjusting histogram styles – bar colors, borders, and axes
  • Overlaying a density line over a histogram
  • Multiple histograms along the diagonal of a pairs plot
  • Histograms in the margins of line and scatter plots

Introduction

In this chapter, we will look at histograms in detail. They are a very useful form of visualization for rapidly viewing the distribution of values of a variable. They are usually one of the first graphs looked at to see whether a variable follows a normal distribution or has a skewed distribution.

We will see how we can enhance the basic histogram ...

Get R: Data Analysis and Visualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.