Creating marginal plots
In the previous sections, we learned how to visualize univariate and bivariate distributions using StatsPlots
. In this section, we will learn how to create a plot that simultaneously displays the joint and marginal distributions for two variables. Usually, we can achieve this by showing three plots in the same figure. The central plot shows the bivariate distribution, for example, using a bi-dimensional histogram. Then, two small plots at the top and right-hand sides of the central plot show the univariate distributions for the x and y variables, respectively. We can take advantage of the layout capabilities of the Plots
package to create such visualizations. We briefly introduced those capabilities in the Simple layouts section of Chapter 1, An Introduction to Julia for Data Visualization and Analysis, and we will expand on that in Chapter 11, Defining Plot Layouts to Create Figure Panels. However, StatsPlots
also offers a series of recipes for marginal plots...