1. 程式人生 > >python matplotlib數據可視化

python matplotlib數據可視化

article img 數據 class () .net show .sh tps

#基於python3

Matplotlib構建的3D圖形:

使用pycharm的小夥伴把sciview給關掉:

技術分享圖片

因為sciview顯示的是png圖片。3d圖形一般我們都需要拖拖拽拽的。

參見: https://blog.csdn.net/xguardian/article/details/81088499 (在python3中,圖像的顯示,必須顯式地調用一下show函數)

常用的三維散點圖:

from mpl_toolkits.mplot3d.axes3d import Axes3D
#繪制3維的散點圖
x = np.random.randint(0,10,size=100)
y = np.random.randint(-20,20,size=100)
z 
= np.random.randint(0,30,size=100) # 此處fig是二維 fig = plt.figure() # 將二維轉化為三維 axes3d = Axes3D(fig) # axes3d.scatter3D(x,y,z) # 效果相同 axes3d.scatter(x,y,z) plt.show() #寫成fig.show()一樣。這裏需要註意的是,python3圖形的顯示必須顯式地調用一下show()函數。

python matplotlib數據可視化