一 代码

  1. import matplotlib as mpl
  2. from mpl_toolkits.mplot3d importAxes3D
  3. import numpy as np
  4. import matplotlib.pyplot as plt
  5. mpl.rcParams['legend.fontsize']=10#图例字号
  6. fig = plt.figure()
  7. ax = fig.gca(projection='3d')#三维图形
  8. theta = np.linspace(-4* np.pi,4* np.pi,100)
  9. z = np.linspace(-4,4,100)*0.3#测试数据
  10. r = z**3+1
  11. x = r * np.sin(theta)
  12. y = r * np.cos(theta)
  13. ax.plot(x, y, z, label='parametric curve')
  14. ax.legend()
  15. plt.show()
二 运行结果
使用matplotlib绘制三维参数曲线
 

相关文章:

  • 2021-09-22
  • 2022-12-23
  • 2021-04-27
  • 2023-03-21
  • 2021-11-27
  • 2021-11-27
猜你喜欢
  • 2021-12-12
  • 2022-01-01
  • 2021-12-02
  • 2021-11-14
  • 2022-12-23
  • 2022-01-18
相关资源
相似解决方案