I am trying to plot the path (or line) integral under a (negative log) bivariate gaussian. I am aiming to produce something that looks like the different stages of this neat little gif I found a wikipedia.
So far, I've produced a (negative log) bivariate normal in 3-d:
import matplotlib
import random
import numpy as np
import seaborn as sns
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.mlab import bivariate_normal
sns.set(style="white", palette="muted", color_codes=True)
%matplotlib inline
def pathIntegral():
# Bivariate gaussian
a = np.linspace(-15, 15, 100)
b = a
X,Y = np.meshgrid(a, b)
Z = bivariate_normal(X, Y)
surprise_Z = -np.log(Z)
# Figure
fig = plt.figure(figsize=(10, 7))
ax = fig.gca(projection='3d')
surf = ax.plot_surface(X, Y, surprise_Z, rstride=1, cstride=1,
cmap = plt.cm.gist_heat_r, alpha=0.1, linewidth=0.1)
ax.scatter(-5, -5, 0, c='k', marker='o')
ax.scatter(5, 5, 0, c='k', marker='o')
Which produces this:
Questions:
1) How do i produce a sufficiently smooth path from two points? E.g. from the two black points that I've drawn in with scatter. I have found this post, but for the life of me can't seem to project that curve on my own x,y axis!
2) Having done so, how would I go about drawing a "curtain" over that path up to the (negative log) bivariate gaussian?
3) An extra plot 2-d (like one of the last ones in the .gif) of the scalar value (negative log gaussian) and euclidiance distance (stright line on x,y) is a bonus question.
Thanks in advance!