I have a parity plot deriving from Machine Learning model predictions vs actual values. I would like to create some density plots to be shown on top and right corners of the main figure. The effect that I would like to achieve can be seen here (original paper):
So given the following:
import matplotlib.pyplot as plt
import seaborn as sns
real = results['real']
pred = results['pred']
fig, ax = plt.subplots(2, 3, figsize=(18, 12))
# Parity plot
ax.scatter(real, pred)
ax.axline([0, 0], [1, 1], linestyle='--', color='red')
How can I obtain the KDE plots on top, sharing the main figure axes?