123456

import numpy as np

 

import matplotlib as mpl

 

import matplotlib.pyplot as plt

 

from mpl_toolkits.mplot3d import Axes3D

 

mpl.rcParams['legend.fontsize'] =10

 

fig=plt.figure()

 

ax = fig.gca(projection='3d')

 

theta = np.linspace(-4*np.pi, 4*np.pi, 108)

 

z = np.linspace(-4, 4, 100)*0.3

 

r=z**3+1

 

×=r*np.sin(theta)

 

y=r*np.cos(theta)

 

ax.p1ot(x, y, z, label='parametric curve')

 

ax.legend()

 

plt.show()

 

 

你可能感兴趣的:(python)