一 柱状图:
import pandas as pd
#pandas的制图功能是构建在matplotlib之上的
import matplotlib.pyplot as plt
#1.使用pandas画图
datas=pd.read_excel(r'D:\test\create3.xlsx',index_col='id')
datas.sort_values(by='price',inplace=True,ascending=False)
#datas.plot.bar(x='name',y='price',color='orange',title='books name by price')
plt.tight_layout()#让标签全展现出来
#让图显现出来
#plt.show()
#2用pandas只能画一写简单的图,下面使用matplotlib功能
plt.bar(datas.name,datas.price,color='orange')
plt.xticks(datas.name,rotation='90')#x标签旋转90度
plt.xlabel('name')
plt.ylabel('price')
plt.title('name by price')
plt.show()