I\'m a bit struggling with seaborn Pairgrid.
Let\'s say I have a Pairgrid like this:
As you can see, the upper triangle plots mirror the lower triangle
With seaborn >= 0.9.1:
import seaborn as sns
iris = sns.load_dataset("iris")
sns.pairplot(iris, corner=True)
this is basically the same as the accepted answer, but uses the official methods from seaborn.PairGrid:
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="ticks")
iris = sns.load_dataset("iris")
def hide_current_axis(*args, **kwds):
plt.gca().set_visible(False)
g = sns.pairplot(iris)
g.map_upper(hide_current_axis)
hiding the lower half is also easy:
g.map_lower(hide_current_axis)
or hiding the diagonal:
g.map_diag(hide_current_axis)
alternatively, just use the PairGrid
directly for more control:
g = sns.PairGrid(iris, hue='species', diag_sharey=False)
g.map_lower(sns.scatterplot, alpha=0.3, edgecolor='none')
g.map_diag(sns.histplot, multiple="stack", element="step")
g.map_upper(hide_current_axis)
which gives: