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
- #86 Avoid overlapping with 2D density
Contour plot
- #80 Contour plot with seaborn
- #80 Density plot with seaborn
- #80 Contour plot with seaborn
2D Histogram
- #83 adjust bin size of 2D histogram
- #83 adjust bin size of 2D histogram
- #83 Change color palette of 2D Histogram
- #83 2D histogram with colorer
Hexbin
- #84 Hexbin plot with Matplotlib
- #84 Change grid size in Hexbin
- #84 Color in Hexbin plot
- #84 Add color bar to hex bin plot
2D Density
- #85 Color of 2D density plot
- #85 2D density plot with matplotlib
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.
- #82 Default Marginal plot
- #82 Custom marginal area
- #82 2D contour with marginal plots
- #82 Custom color of marginal plot
related
- Heatmap
- Bubble plot
- Scatterplot