matplotlibで3次元グラフを描く
# Jupyter Notebook で描く場合 %matplotlib inline import numpy as np import matplotlib.pylab as plt from mpl_toolkits.mplot3d import Axes3D def function_2(x): return x[0]**2 + x[1]**2 x = [] x.append(np.arange(-3.0, 3.0, 0.2)) x.append(np.arange(-3.0, 3.0, 0.2)) mg_0, mg_1 = np.meshgrid(x[0], x[1]) y = function_2([mg_0, mg_1]) fig = plt.figure() ax = Axes3D(fig) ax.plot_wireframe(mg_0, mg_1, y) plt.show()