要创建一个3D图,你需要使用mpl_toolkits.mplot3d模块中的Axes3D类‘’

动态 未结 0 122
小小草
小小草 LV1 2023年9月23日 23:40 发表
是的,你需要使用`mpl_toolkits.mplot3d`模块中的`Axes3D`类来创建3D图。以下是一个简单的例子: ```python import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = fig.add_subplot(111, projection='3d') x = [1, 2, 3, 4, 5] y = [2, 3, 4, 5, 6] z = [3, 4, 5, 6, 7] ax.scatter(x, y, z) plt.show() ``` 这将创建一个简单的3D散点图。
收藏(0)  分享
相关标签: 智能问答
问题没解决?让AI助手帮你作答 AI助手
0个回复
  • 消灭零回复