数据可视化

 

 

python图形库:https://www.python-graph-gallery.com/

 

 

2D图:

import matplotlib.pyplot as plt
plt.figure()
plt.scatter(x_1[:,0] , x_1[:,2],marker=.,color=r)
plt.scatter(x_2[:,0] , x_2[:,2],marker=.,color=g)
plt.scatter(x_3[:,0] , x_3[:,2],marker=.,color=b)
plt.show()

 

 

3D图:

import matplotlib.pyplot as plt
fig=plt.figure()
import mpl_toolkits.mplot3d as mp3d ax=mp3d.Axes3D(fig) ax.scatter(x_1[:,0],x_1[:,1],x_1[:,2])
ax.plot3D(x_1[:,0],x_1[:,1],x_1[:,2])
ax.set_xlabel(x) ax.set_ylabel(y) ax.set_zlabel(z) ax.view_init(elev=45,azim=45)#从y俯视

 

相关系数图:

import seaborn as sns
# 检验新的自变量和charges的相关性
corr_df = pd.DataFrame(x_poly, columns=[one,two,three,four])
corr_df[charges] = y
plt.figure()
sns.heatmap(corr_df.corr(), annot=True)

 

饼状图:

import matplotlib.pyplot as plt
kinds = "m", "n", "l", "k"
colors = ["red", "pink", "blue", "yellow"]        
soldNums = [1,1, 1, 2]
plt.pie(soldNums, labels=kinds, autopct="%3.1f%%", startangle=90, colors=colors)
plt.title("不同类型箱子的销售数量占比")
plt.show()

 

数据可视化

上一篇:如何实现高效处理百万级句柄


下一篇:Oracle配置tcps加密协议