1 # -*-coding: utf-8- -*- 2 ‘‘‘ 3 Create on 2020/04/14 4 @author: Atwood Zhang 5 ‘‘‘ 6 7 import numpy as np 8 import matplotlib.pyplot as plt 9 import mpl_toolkits.mplot3d 10 11 x = np.array([1, 2, 4, 5, 6]) 12 y = np.array([2, 3, 4, 5, 6]) 13 z = np.array([1, 2, 4, 5, 6]) 14 15 ax = plt.subplot(projection = ‘3d‘) # 创建一个三维的绘图工程 16 ax.set_title(‘3d_image_show‘) # 设置本图名称 17 ax.scatter(x, y, z, c = ‘r‘) # 绘制数据点 c: ‘r‘红色,‘y‘黄色,等颜色 18 19 ax.set_xlabel(‘X‘) # 设置x坐标轴 20 ax.set_ylabel(‘Y‘) # 设置y坐标轴 21 ax.set_zlabel(‘Z‘) # 设置z坐标轴 22 23 plt.show()
原文地址:https://www.cnblogs.com/cainiaoxuexi2017-ZYA/p/12695405.html
时间: 2024-11-07 00:07:52