pythonはmatplotlibを利用して3 D空間に二次放物線を描いた事例を紹介します。


図のプレビュー:

0、import

import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
1、開口から上への放物線

fig = plt.figure(figsize=(9,6),
         facecolor='khaki'
        )
ax = fig.gca(projection='3d')
#           
x = np.linspace(start=-3,
        stop=3,
        num=100
        )
y = np.linspace(start=-3,
        stop=3,
        num=100
        )
X, Y = np.meshgrid(x, y)  #     
Z = np.power(X, 2) + np.power(Y, 2)  #      z = x**2 + y**2
#   
surf = ax.plot_surface(X=X,
            Y=Y,
            Z=Z,
            rstride=2,  # row stride,    
            cstride=2,  # column stride,     
            color='r',
            linewidth=0.5,
           )
#     
ax.view_init(elev=7,  #   
       azim=30  #    
      )
#     
plt.show()
図:

2、開口下の放物面

fig = plt.figure(figsize=(9,6),
         facecolor='khaki'
        )
ax = fig.gca(projection='3d')
#           
x = np.linspace(start=-3,
        stop=3,
        num=100
        )
y = np.linspace(start=-3,
        stop=3,
        num=100
        )
X, Y = np.meshgrid(x, y)  #     
Z = np.power(X, 2) + np.power(Y, 2)  #      z = x**2 + y**2
#   
surf = ax.plot_surface(X=X,
            Y=Y,
            Z=-Z,
            rstride=2,  # row stride,    
            cstride=2,  # column stride,     
            color='g',
            linewidth=0.5,
           )
#     
ax.view_init(elev=7,  #   
       azim=30  #    
      )
#     
plt.show()
図:

3、マルチゾーンで異なる放物線を表示する

fig = plt.figure(figsize=(24, 16),
         facecolor='khaki'
        )
#           
x = np.linspace(start=-3,
        stop=3,
        num=100
        )
y = np.linspace(start=-3,
        stop=3,
        num=100
        )
X, Y = np.meshgrid(x, y)  #     
Z = np.power(X, 2) + np.power(Y, 2)  #      z = x**2 + y**2
# -------------------------------- subplot(221) --------------------------------
ax = fig.add_subplot(221, projection='3d')
#         
surf = ax.plot_surface(X=X,
            Y=Y,
            Z=Z,
            rstride=2,  # row stride,    
            cstride=2,  # column stride,     
            color='r',
            linewidth=0.5,
           )
# -------------------------------- subplot(223) --------------------------------
ax = fig.add_subplot(223, projection='3d')
#         
surf = ax.plot_surface(X=X,
            Y=Y,
            Z=-Z,
            rstride=2,  # row stride,    
            cstride=2,  # column stride,     
            color='g',
            linewidth=0.5,
           )
# -------------------------------- subplot(22, (2,4)) --------------------------------
ax = plt.subplot2grid(shape=(2,2),
           loc=(0, 1),
           rowspan=2,
           projection='3d'
           )
#         
surf1 = ax.plot_surface(X=X,
            Y=Y,
            Z=Z,
            rstride=2,  # row stride,    
            cstride=2,  # column stride,     
            color='r',
            linewidth=0.5,
            )
#         
surf2 = ax.plot_surface(X=X,
            Y=Y,
            Z=-Z,
            rstride=2,  # row stride,    
            cstride=2,  # column stride,     
            color='g',
            linewidth=0.5,
           )
#     
ax.view_init(elev=7,  #   
       azim=30  #    
      )
# -------------------------------- fig --------------------------------
#       
fig.subplots_adjust(wspace=0.1,  # width space
          hspace=0.15  # height space
          )
#     
plt.show()
図:

ソフトウェアバージョン:

以上は個人の経験ですので、参考にしていただければと思います。間違いがあったり、完全に考えていないところがあれば、教えてください。