Marginalize a surface plot and use kernel density estimation (kde) on it
问题 As a minimal reproducible example, suppose I have the following multivariate normal distribution: import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from scipy.stats import multivariate_normal, gaussian_kde # Choose mean vector and variance-covariance matrix mu = np.array([0, 0]) sigma = np.array([[2, 0], [0, 3]]) # Create surface plot data x = np.linspace(-5, 5, 100) y = np.linspace(-5, 5, 100) X, Y = np.meshgrid(x, y) rv = multivariate_normal(mean=mu,