This section regroups several chart types used to study the **joint distribution** of 2 numerical variables. All these methods are really useful to avoid over plotting in a scatterplot. If you have too many dots, they basically counts the number of observations

within a particular area of the 2D space and represent this count by a color. If you divide the space by several squares you get a** 2D histogram**. If you use hexagons you get a **hexbin plot. **You can also calculate Density estimate and represent **2D density plots**

or **Contour plots**. Fortunately, the ggplot2 __library__ has awesome geoms to easily produce this kind of charts. Note that it is a good practice to show the marginal distributions of both variables.

Sponsors

**2d histogram**

This is the 2d version of the classic histogram. The plot area is split in a multitude of small squares, the number of points in each square is represented by its color.

**Hexbin**

This is the equivalent of the 2d histogram, but the plot area is split in a multitude of hexagones this time. This technic is also appreciated to create hexbin maps.

**2d distribution**

Like it is possible to plot a density instead of an histogram to represent a distribution, it is possible to make a 2d density plot. Several variations are available using ggplot2:

**Without ggplot2**

It is also possible to realise this kind of plot without ggplot2, even if it is often way more complicated..

**Related**

**Search the gallery**