18 python数据可视化stackplot, broken_barh, step, tabel

浏览:2095
00 载入扩展库
import numpy as np
import matplotlib.pyplot as plt
01 stackplot()
x=np.arange(1,6,1)
y=[1,3,4,2,7]
y1=[3,4,1,6,5]
plt.stackplot(x,y,y1)
02 broken_barh()
plt.broken_barh([(30,100),(180,50)],(20,8))
03 step()
x=np.linspace(1,10,10)
y=np.sin(x)
plt.step(x,y,color='r',where='pre',marker='o',mfc='k')
plt.step(x,y,color='r',where='mid',marker='^',mfc='k')
plt.step(x,y,color='r',where='post',marker='s',mfc='k')
04 tabel()
x=[40,15,20,25]
leg,label,pct=plt.pie(x,autopct='%.0f%%')
collabel=['A','C','D','E']
rowlabel=['stu']
celltext=[(200,300,380,230)]
plt.table(colLabels=collabel,colLoc='right',colWidths=[0.4]*4,
cellText=celltext,cellLoc='center',
rowLabels=rowlabel,loc='top')

技术邻APP
工程师必备
工程师必备
- 项目客服
- 培训客服
- 平台客服
TOP

1