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. POJ-2253-Frogger +最短路小变形

    传送门:http://poj.org/problem?id=2253 参考:https://www.cnblogs.com/lienus/p/4273159.html 题意:给出一个无向图,求一条从 ...

  2. Codeforces 898 B(拓展欧几里得)

    Proper Nutrition 题意:有n元钱,有2种单价不同的商品,是否存在一种购买方式使得钱恰好花光,如果有输入任意一种方式,如果没有输出“NO” 题解:可以使用拓展欧几里得快速求解. #inc ...

  3. Fractions Again?! UVA - 10976

    It is easy to see that for every fraction in the form 1k(k > 0), we can always find two positive ...

  4. codeforces 572 C. Lengthening Sticks(数学)

    题目链接:http://codeforces.com/contest/572/problem/C 题意:给出a,b,c,l要求a+x,b+y,c+z构成三角形,x+y+z<=l,成立的x,y,z ...

  5. 【Redis】哨兵机制

    一.概述 什么是哨兵机制 二.环境配置 2.1 虚拟机 2.2 安装Redis 2.3 配置主从复制 2.4 配置哨兵 2.5 测试 2.6 疑惑(待解决) 一.概述 什么是哨兵机制 Redis的哨兵 ...

  6. debug 模式缓慢

    debug 模式启动服务器,然后在 breakopints下可以看到打的断点.清除全部重启服务器,问题解决.

  7. Go语言标准库之flag

    Go语言内置的flag包实现了命令行参数的解析,flag包使得开发命令行工具更为简单. os.Args 如果你只是简单的想要获取命令行参数,可以像下面的代码示例一样使用os.Args来获取命令行参数. ...

  8. [0]尝试用Unity3d制作一个王者荣耀(持续更新)->游戏规划

    太得闲了于是想写个农药,虽然可能会失败但是还是要试一试. 因为是自学的不是Unity专业的可能表达语言会有些不标准!望见谅! 结构: 以组件式(比如说摇杆控制和玩家部分的编写是分离的,可以自由拼装)作 ...

  9. change,Ringo题目

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  10. java读取Excel —— XSSFWorkbook 找不到该类