Matplotlib之Bar Chart:

import numpy as np
import matplotlib.pyplot as plt data = [[300, 200, 250, 150, 280],
[300, 166, 203, 250, 225],
[100, 110, 115, 150, 112],
[300, 200, 250, 150, 280],
[20, 30, 15, 10, 12],
[20, 10, 10, 10, 20]] columns = ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday')
rows = [x for x in ("EQP.NY", "EQB.NY", "EQP.LN", "EQB.LN", "FIP.NY", "FIB.NY")] values = np.arange(0, 2000, 500) # Get some pastel shades for the colors
colors = plt.cm.YlOrRd(np.linspace(0, 0.7, len(rows))) n_rows = len(data) index = np.arange(len(columns)) + 0.3
bar_width = 0.4 # Initialize the vertical-offset for the stacked bar chart.
y_offset = np.zeros(len(columns)) # Plot bars and create text labels for the table
cell_text = []
for row in range(n_rows):
plt.bar(index, data[row], bar_width, bottom=y_offset, color=colors[row])
y_offset = y_offset + data[row]
cell_text.append(['%u' % x for x in data[row]])
# Reverse colors and text labels to display the last value at the top.
colors = colors[::-1]
cell_text.reverse()
# print(cell_text) # Add a table at the bottom of the axes
the_table = plt.table(cellText=cell_text,
rowLabels=rows[::-1],
rowColours=colors,
colLabels=columns,
loc='bottom') # Adjust layout to make room for the table:
plt.subplots_adjust(left=0.2, bottom=0.25) # plt.ylabel("Loss in ${0}'s".format(value_increment))
plt.ylabel('Break counts')
# print(values)
plt.yticks(values, ['%d' % val for val in values])
plt.xticks([])
plt.title('Break Recon Summary') plt.show()

效果:

Matplotlib之Bar Chart的更多相关文章

  1. matplotlib 柱状图 Bar Chart 样例及参数

    def bar_chart_generator():     l = [1,2,3,4,5]     h = [20, 14, 38, 27, 9]     w = [0.1, 0.2, 0.3, 0 ...

  2. Bar Chart of Frequency of modals in different sections of the Brown Corpus

    Natural Language Processing with Python Chapter 4.8 colors = 'rgbcmyk' # red, green, blue, cyan, mag ...

  3. Highcharts - Bar Chart & Column Chart

    1. 条形图(Bar Chart)需要的数据格式类型如下: ["Luke Skywalker", "Darth Vader", "Yoda" ...

  4. Relative-Frequency|frequency|pie chart |bar chart

    2.2Organizing Qualitative Data The number of times a particular distinct value occurs is called its ...

  5. bubble chart|Matrix Scatter|Overlay Scatter|Scatterplots|drop-line|box plot|Stem-and-leaf plot|Histogram|Bar chart|Pareto chart|Pie chart|doughnut chart|

    应用统计学 对类别数据要分类处理: Bar chart复式条形图便于对比: Pareto chart:对类别变量依据频数高低排列: Pie chart:饼图用于一个样本,可以区分类别数据 doughn ...

  6. Matplotlib学习---用matplotlib画柱形图,堆积柱形图,横向柱形图(bar chart)

    这里利用Nathan Yau所著的<鲜活的数据:数据可视化指南>一书中的数据,学习画图. 数据地址:http://datasets.flowingdata.com/hot-dog-cont ...

  7. 转 HighCharts笔记之: Bar Chart

    最近需要做一些Web图标,研究了几个开源的第三方工具后,最后决定使用HighCharts开发: Highcharts 是一个用纯JavaScript编写的一个图表库, 能够很简单便捷的在web网站或是 ...

  8. plot bar chart using python

    Example import matplotlib.pyplot as plt import plotly.plotly as py # Learn about API authentication ...

  9. Bar Chart _Study

    ---恢复内容开始--- 以“3D BarChart”为例. 1.Select a theme.(选择一个主题模板) 2.Set up categories and groups.(设置类型和组) 3 ...

随机推荐

  1. CodeForces 931E Game with String

    Game with String 题意:有一个字符串,可以选择从第K位开始,将[K,len(s)-1]的字符都移到前面去,现在给你一个首字母,你可以再选择一位进行观察,然后猜测这个K的值是多少, 现在 ...

  2. codeforces 572 D. Minimization(dp+ 思维)

    题目链接:http://codeforces.com/contest/572/problem/D 题意:给出一个序列,可以任意调整序列的顺序,使得给出的式子的值最小 题解:显然要先排一下序,然后取相邻 ...

  3. HTML5基本介绍

    HTML5简介 HTML是互联网上应用最广泛的标记语言.HTML文件就是普通文本+HTML标记,而不同的HTML标记能表示不同的效果.(简单的说HTML是超文本标记语言) HTML5草案的前身名为 W ...

  4. ui、li模拟下拉框

    转载:原文地址:https://www.jianshu.com/p/e303e0298e9e 效果图: HTML: <div class="rank_top"> < ...

  5. 【UEFI】---BIOS中UserPassword的重复校验总结

    UEFI作为目前较为流行的一套X86架构初始化的标准框架,已受到业界内的广泛认可.而其中很多编程所采用的思想确实值得学习.今天总结下UEFI的框架下修改代码的一点小经验,仅供菜鸟参考. 先列干货,具体 ...

  6. 美团集群调度系统HULK技术演进

    本文根据美团基础架构部/弹性策略团队负责人涂扬在2019 QCon(全球软件开发大会)上的演讲内容整理而成.本文涉及Kubernetes集群管理技术,美团相关的技术实践可参考此前发布的<美团点评 ...

  7. VG有空间,创建逻辑卷

    1.查看VG空间 [root@CNSZ22PL2787 ~]# vgs VG #PV #LV #SN Attr VSize VFree VolGroup00 1 7 0 wz--n- 1.63t 1. ...

  8. 基于python的selenium两种文件上传操作

    方法一.input标签上传     如果是input标签,可以直接输入路径,那么可以直接调用send_keys输入路径,这里不做过多赘述,前文有相关操作方法. 方法二.非input标签上传 这种上传方 ...

  9. Visual Studio Code 安装美化合集

    这是一个关于VSCode编辑器的各种配置. 你可以在这里找到VSCode 的各种操作,如果这里找不到,请移步官方文档C++ programming with Visual Studio Code以及各 ...

  10. Docker学习之Dockerfile

    通过编写简单的文件创建docker镜像 dockerfile 用来创建docker镜像. 格式 : FROM alpine:latest MAINTAINER XSW CMD echo "h ...