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()