pie hist plot boxplot
原创
©著作权归作者所有:来自51CTO博客作者luoganttcc的原创作品,请联系作者获取转载授权,否则将追究法律责任
画大饼
import matplotlib.pyplot as plt
labels='uu','y','j','dd'
sizes=[15,30,45,10]
color=['yellow','gold','blue','red']
explode=(0,0.1,0,0)
plt.pie(size,explode=explode,labels=label,colors=colors,autopct='%1.1f%%',shadow=True,startangle=90)
plt.axis('equal')
plt.show()
plot 画图 和scatter 类似
import numpy as np
import matplotlib.pyplot as plt
from math import sin
x=np.arange(0,10,0.2)
y=np.sin(x)
plt.plot(x,y,c='b',linewidth=1,alpha=0.7,marker='p',label='cc')
plt.title('sin()')
plt.xlabel('x')
plt.ylabel('y')
plt.legend(loc='upper right')
plt.show()
直方图
import matplotlib.pyplot as plt
import numpy as np
x=np.random.randn(10000)
plt.hist(x,10)
plt.show()
boxplot()
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from pandas import Series
x=np.random.randn(1000)
d=pd.DataFrame([x,x+1]).T
d.boxplot()
plt.show()