In this chapter, we will cover the following recipes:
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 in R by adjusting some parameters in the base graphics library. We will learn how to change certain settings to control the format in which the histogram is plotted (the frequency or probability of values) and also how the values are grouped into bins. We will also look at the usual parameters to change the styling of histogram bars, such as color, width, and border. In addition, we will also look at some advanced recipes combining histograms with other types of graphs.
As with the previous chapters, it is best to try out each recipe first with the example shown here and then with your own datasets, so that you can fully understand each line of code.
3.17.110.113