作家
登录

5使用Python代码轻松实现数据可视化的方法

作者: 来源: 2018-03-26 15:24:38 阅读 我要评论

            # For each category after the first, the bottom of the  
  •             # bar will be the top of the last category  
  •             ax.bar(x_data, y_data_list[i], color = colors[i], bottom = y_data_list[i - 1], align = 'center', label = y_data_names[i])  
  •     ax.set_ylabel(y_label)  
  •     ax.set_xlabel(x_label)  
  •     ax.set_title(title)  
  •     ax.legend(loc = 'upper right'
  •   
  •  
  • def groupedbarplot(x_data, y_data_list, colors, y_data_names="", x_label="", y_label="", title=""):  
  •     _, ax = plt.subplots()  
  •     # Total width for all bars at one x location  
  •     total_width = 0.8  
  •     # Width of each individual bar  
  •     ind_width = total_width / len(y_data_list)  
  •     # This centers each cluster of bars about the x tick mark  
  •     alteration = np.arange(-(total_width/2), total_width/2, ind_width)  
  •   
  •  
  •     # Draw bars, one category at a time  
  •     for i in range(0, len(y_data_list)):  
  •         # Move the bar to the right on the x-axis so it doesn't  
  •         # overlap with previously drawn ones  
  •         ax.bar(x_data + alteration[i], y_data_list[i], color = colors[i], label = y_data_names[i], width = ind_width)  
  •     ax.set_ylabel(y_label)  
  •     ax.set_xlabel(x_label)  

  •   推荐阅读

      HTTPS那些协议:TLS, SSL, SNI, ALPN, NPN

    沙龙晃荡 | 3月31日 京东、微博、华为拭魅战专家与你合营商量容器技巧实践! 本文存眷个中 Web 办事(HTTPS)相干>>>详细阅读


    本文标题:5使用Python代码轻松实现数据可视化的方法

    地址:http://www.17bianji.com/lsqh/40891.html

    关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)