Hexbin Closed Joint Matrix

I am trying to create a matrix of paired graphs comparing distributions ( something like this ). Since I have a lot of points, I want to use the hexbin chart to reduce the time and complexity of the plot.

import seaborn as sns import matplotlib.pyplot as plt tips = sns.load_dataset("tips") g = sns.FacetGrid(tips, col="time", row="sex") g.map(sns.jointplot, "total_bill", "tip", kind="hex") plt.show() 

However, instead of creating a chart matrix, he creates several charts independently in different windows.

I also thought about using seaborn.pairplot to create this, but I cannot pass "hex" as a kind value.

+4
source share
1 answer

See the last example in the tutorial on using custom functions with FacetGrid , which I will reproduce here:

 def hexbin(x, y, color, **kwargs): cmap = sns.light_palette(color, as_cmap=True) plt.hexbin(x, y, gridsize=15, cmap=cmap, **kwargs) g = sns.FacetGrid(tips, hue="time", col="time", size=4) g.map(hexbin, "total_bill", "tip", extent=[0, 50, 0, 10]) 

enter image description here

+6
source

All Articles