# Author: Ika, 2013-07-26
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')
ax.set_xlabel('x')
ax.set_ylabel('y')
# Prepare the data to plot
X = np.arange(-8, 8, 0.5)
Y = np.arange(-8, 8, 0.5)
X, Y = np.meshgrid(X, Y)
Z = X*X - Y*Y
# Plot the surface
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet, linewidth=0, antialiased=False)
# Plot the saddle point
x=y=z=np.arange(-0.1,0.1,0.1)
ax.plot(x, y, z, 'r+', linewidth=1)
ax.text(-2,0,2,r'(0,0,0)',fontsize=20)
fig.colorbar(surf, shrink=0.5, aspect=5)
# Save the figure to the output SVG file
plt.savefig("Saddle_Point_SVG.svg");