pie hist plot boxplot

画大饼

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

这里写图片描述

posted @ 2022-08-19 23:00  luoganttcc  阅读(12)  评论(0编辑  收藏  举报