In [1]:
%pylab
%matplotlib inline
In [2]:
%load_ext watermark
%watermark
In [3]:
from mpl_toolkits.mplot3d import axes3d
In [4]:
x = np.arange(-10., 10., 0.2)
y = np.arange(-10., 10., 0.2)
x = x.reshape(len(x), 1)
z = x * y
print(z)
In [5]:
pylab.rcParams["figure.figsize"] = (10, 8)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_wireframe(x, y, z, rstride=6, cstride=6)
ax.scatter([-2], [3], [-6], c='r')
ax.quiver([-2, -2], [3, 3], [-6, -6], [0, 0.1], [-0.1, 0], [0.2, 0.3],
length=7, color='red', pivot='tail')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('X * Y')
plt.gca().set_xlim([-10, 10])
plt.gca().set_ylim([-10, 10])
plt.gca().set_zlim([-100, 100])
plt.gca().invert_xaxis()
plt.gca().invert_yaxis()
plt.show()
In [ ]: