zoukankan      html  css  js  c++  java
  • 柱状图

    import pandas as pd
    import matplotlib.pyplot as plt
    
    students=pd.read_excel('c:/Temp/Students.xlsx')
    
    students.sort_values(by = 'Number',inplace= True ,ascending= False)
    
    #sort_values 排序
    #以Numberi排序
    # inplace=True:不创建新的对象,直接对原始对象进行修改;
    # inplace=False:对数据进行修改,创建并返回新的对象承载其修改结果
    # ascending是否正序排
    
    
    students.plot.bar(x='Field',y='Number',color='orange',title= "intertional students field")   #Field为 x轴   Number为Y轴
    print (students)
    
    plt.show()  #展示图
    import pandas as pd
    import matplotlib.pyplot as plt
    
    students=pd.read_excel('c:/Temp/Students.xlsx')
    
    students.sort_values(by = 'Number',inplace= True ,ascending= False)
    
    #sort_values 排序
    #以Numberi排序
    # inplace=True:不创建新的对象,直接对原始对象进行修改;
    # inplace=False:对数据进行修改,创建并返回新的对象承载其修改结果
    # ascending是否正序排
    
    
    # students.plot.bar(x='Field',y='Number',color='orange',title= "intertional students field")   #Field为 x轴   Number为Y轴
    
    plt.bar(students.Field,students.Number,color='orange')
    plt.xticks(students.Field,rotation='90')   #Field 标签旋转90
    print (students)
    plt.xlabel('Field')
    plt.ylabel('Number')
    plt.title('intertional students field',fontsize=16)
    
    #x轴名称,y轴名称,标题及字号
    
    plt.tight_layout()  #紧凑型视图
    plt.show()  #展示图
  • 相关阅读:
    mescroll vue tab页实现切换刷新列表
    路由权限配置
    js实现拖拽
    .eslintrc.js
    vue-cli项目中使用mock结合axios-mock-adapter生成模拟数据【转】
    原型模式
    设计模式简介
    @RequestParam @RequestBody @PathVariable 等参数绑定注解详解
    spring定时任务执行两次
    java反射--注解的定义与运用以及权限拦截
  • 原文地址:https://www.cnblogs.com/inserence/p/10995604.html
Copyright © 2011-2022 走看看