In [1]:
%pylab
%matplotlib inline


Using matplotlib backend: MacOSX
Populating the interactive namespace from numpy and matplotlib

In [2]:
%load_ext watermark
%watermark


2016-09-11T20:33:48

CPython 3.5.2
IPython 5.0.0

compiler   : GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)
system     : Darwin
release    : 15.6.0
machine    : x86_64
processor  : i386
CPU cores  : 8
interpreter: 64bit

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)


[[ 100.     98.     96.   ...,  -94.    -96.    -98.  ]
 [  98.     96.04   94.08 ...,  -92.12  -94.08  -96.04]
 [  96.     94.08   92.16 ...,  -90.24  -92.16  -94.08]
 ..., 
 [ -94.    -92.12  -90.24 ...,   88.36   90.24   92.12]
 [ -96.    -94.08  -92.16 ...,   90.24   92.16   94.08]
 [ -98.    -96.04  -94.08 ...,   92.12   94.08   96.04]]

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 [ ]: