A 2D density plot or ** 2D histogram **is an extension of the well known histogram. It shows the distribution of values in a data set across the range of two quantitative variables. It is really

useful to avoid over plotting in a scatterplot. If you have too many dots, the 2D density plot counts the number of observations within a particular area of the 2D space. This specific area can be

a square or a hexagon (hexbin). You can also estimate a 2D kernel density estimation and represent it with contours.

Note that this online course has a chapter dedicated to 2D arrays visualization.

## Sponsors

**From overlapping scatterplot to 2D density**

**Contour plot**

**2D Histogram**

**Hexbin **

**2D Density**

**Marginal plots**

If you have a huge amount of dots on your graphic, it is advised to represent the **marginal distribution** of both the X and Y variables. This is easy to do using the jointplot() function of the Seaborn library.

**related**