import pandas as pd
import numpy as np
import random
#柱状图展示
testdata_bar = pd.DataFrame([random.random() for i in range(5)])
testdata_bar.plot(kind = 'bar',figsize = (5,2),color = 'red',alpha = 0.6,grid = True)
#横向柱状图
testdata_bar.plot(kind = 'barh',figsize = (5,2),color = 'red',alpha = 0.6,grid = True)
#折线图展示
testdata_line = pd.DataFrame([random.random() for i in range(5)])
testdata_line.plot(kind = 'line',figsize = (5,2),color = 'red',alpha = 0.6,grid = True)
#散点图展示
XH = ([x for x in range(0,5)])
testdata_scatter = pd.DataFrame([random.random() for i in range(5)])
testdata_scatter['XH'] = XH
testdata_scatter.plot(kind ='scatter',x='XH',y=0,figsize = (5,2),color = 'red',alpha = 0.6,grid = True,ylim = [
pandas自带绘图程序(柱状图、折线图、散点图、饼图、堆叠图)
最新推荐文章于 2022-11-03 23:17:20 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)