Created
July 23, 2019 03:27
-
-
Save MinaGabriel/e3335d75edb03b696015a7d033fddebd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
from matplotlib.ticker import LinearLocator, FormatStrFormatter | |
import numpy as np | |
from scipy.stats import norm | |
fig = plt.figure() | |
ax = fig.gca(projection='3d') | |
# Make data. | |
X = np.arange(0.01, 10, 0.1) | |
Y = np.arange(0.01, 10, 0.1) | |
X, Y = np.meshgrid(X, Y) | |
Z = norm(X, Y).pdf(5) * norm(X, Y).pdf(6) | |
mina = np.array(Z).reshape(1,-1) | |
print(max(mina[0])) | |
# Plot the surface. | |
surf = ax.plot_surface(X, Y, Z, cmap=cm.coolwarm, alpha=0.4, | |
linewidth=0.2, antialiased=False) | |
# Customize the z axis. | |
ax.set_zlim(0, 0.2) | |
ax.set_xlim(-1, 10) | |
ax.set_ylim(-1, 10) | |
ax.zaxis.set_major_locator(LinearLocator(5)) | |
ax.set_zticklabels([]) | |
ax.view_init(30, 25) | |
ax.set_xlabel('$\mu$') | |
ax.set_ylabel('$\sigma$') | |
ax.set_zlabel('$p(5 | \mu, \sigma)$ X $p(6 | \mu, \sigma) $') | |
# Add a color bar which maps values to colors. | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment