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

    水平柱状图模板

    import matplotlib.pyplot as plt
    import numpy as np
    
    x_data = ['2011','2012','2013','2014','2015','2016','2017']
    y_data = [58000,60200,63000,71000,84000,90500,107000]
    bar_width = 0.3
    plt.barh(y=range(len(x_data)),
            width=y_data,
            label='Java基础教程',
            # 颜色名要写对
            color='steelblue',
            alpha=0.8,
            height=bar_width,
            )
    for y,x in enumerate(y_data):
        plt.text(x+5000, y-bar_width/2, '%s'%x, ha='center', va='bottom')
    plt.yticks(np.arange(len(x_data)) + bar_width/2, x_data)
    plt.title("kkk")
    # plt.legend()
    plt.show()

    参考:https://blog.csdn.net/fei347795790/article/details/94331023

  • 相关阅读:
    AngularJS
    Java
    Java
    AngularJS
    Java
    Java
    AngularJS
    Java
    Debian
    Java
  • 原文地址:https://www.cnblogs.com/xxswkl/p/14626801.html
Copyright © 2011-2022 走看看