Created
June 18, 2018 12:01
-
-
Save zztalker/38aa737d65dbd49d1e70ac865dc7655f to your computer and use it in GitHub Desktop.
3d_plot.py
This file contains 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 | |
from matplotlib import cm | |
from matplotlib.ticker import LinearLocator, FormatStrFormatter | |
import matplotlib.pyplot as plt | |
import numpy as np | |
fig = plt.figure() | |
ax = fig.gca(projection='3d') | |
X = np.arange(1, 9, 1) | |
print(X) | |
Y = np.arange(1, 9, 1) | |
print(Y) | |
X, Y = np.meshgrid(X, Y) | |
print(X) | |
print(Y) | |
Z = X*Y | |
print(Z) | |
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm, | |
linewidth=0, antialiased=False) | |
ax.set_zlim(0, 64) | |
ax.zaxis.set_major_locator(LinearLocator(10)) | |
ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f')) | |
fig.colorbar(surf, shrink=0.5, aspect=5) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment