I would like to plot data which is defined only for each unordered pair of distinct elements in a set. This is naturally represented by a lower-- or upper--triangular matrix, with no values on the diagonal. A correlation matrices is an example.
I might plot it like this
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
mat = np.random.randn(12,12)
# Generate a mask for the upper triangle
mask = np.triu(np.ones_like(mat, dtype=bool))
sns.heatmap(mat, mask=mask, cmap="vlag", square=True, linewidths=.5, cbar=None)
giving
But I would prefer to plot it like this
Or perhaps with the labels showing each once on the hypoteneuse/diagonal would be nicer, rather than repeated on the two sides like I have done.
Is there a natural way to do this with pyplot or seaborn (or R)? I'm sure there's a relatively simple hacky way, but I wonder if there's a package out there that already does something like this. It seems like a natural way to represent symmetric relation data.