maplotlib python 玩具绘图 横向纵向条状图
from matplotlib import font_manager
#解决zh-han图形汉字乱码
my_font = font_manager.FontProperties(fname="C:/Windows/Fonts/simsun.ttc") def draw_xmap(x_list,y_list):
""" daily map draw """
try:
import matplotlib.pyplot as plt1
except Exception as e:
print(e)
else: plt1.figure(figsize=(14,10))
def autolabel(rects):
plt1.xlabel("项目名",fontproperties=my_font)
plt1.ylabel("项目组人力人均饱和度值",fontproperties=my_font)
plt1.xticks(fontproperties=my_font, fontsize=10,rotation=0)
for rect in rects:
height = rect.get_height()
plt1.text(rect.get_x()+rect.get_width()/2.- 0.2, 0.999*height, '%s' % height)
y_list.sort()
autolabel(plt1.bar(range(len(y_list)), y_list,color='#87CEFA',tick_label=x_list,width=0.4))
if os.path.exists(os.getcwd()+'\\pngdir'):
pass
else:
os.mkdir(os.getcwd()+"\\pngdir")
plt1.savefig('../toy/pngdir/daysara.png') def draw_hmap(h_list,value_list):
value_list=[ float('%.3f' % i) for i in value_list]
""" week map draw """
try:
import numpy as np
import matplotlib.pyplot as plt
except Exception as e:
print(e)
else:
y_pos = np.arange(len(h_list))
value_list.sort()
plt.figure(figsize=(14,10))
reacts=plt.barh(y_pos, value_list, align='center',height=0.6)#这里是产生横向柱状图 barh h--horizontal
plt.yticks(y_pos, h_list,fontproperties=my_font, fontsize=10)
plt.xlabel('个人日均饱和度',fontproperties=my_font)
plt.ylabel("日均和度人员",fontproperties=my_font)
plt.xlim(0,2)
plt.title('RANK No.')
for index,x in enumerate(value_list):
for r in reacts:
plt.text(x,index-0.4/2,'%s' % x)
if os.path.exists(os.getcwd()+'\\pngdir'):
pass
else:
os.mkdir(os.getcwd()+"\\pngdir")
plt.savefig('../toy/pngdir/weeksara.png')
maplotlib python 玩具绘图 横向纵向条状图的更多相关文章
- python中matplotlib绘图封装类之折线图、条状图、圆饼图
DrawHelper.py封装类源码: import matplotlib import matplotlib.pyplot as plt import numpy as np class DrawH ...
- HighCharts之2D堆条状图
HighCharts之2D堆条状图 1.HighCharts之2D堆条状图源码 StackedBar.html: <!DOCTYPE html> <html> <head ...
- HighCharts之2D条状图
HighCharts之2D条状图 1.HighCharts之2D条状图源码 bar.html: <!DOCTYPE html> <html> <head> < ...
- Excel 2010高级应用-条状图(五)
Excel 2010高级应用-条状图(五) 基本操作如下: 1.新建一个Excel空白文档,并命名条状图 2.单击"插入",找到条状图的样图 3.选择其中一种类型的条状图样图,在空 ...
- Flex实现双轴条状图
1.问题背景 一般的,柱状图可以实现双轴图,但是如何实现双轴条状图? 2.实现实例 <?xml version="1.0" encoding="utf-8" ...
- 利用js来画图形(例如:条状图,圆饼图等)
背景:java开发的过程中,需要对数据进行可视化,这样方便客户理解此时的数据状态 语言:java,js,window7,echarts包文件 sample的例子下面的参照 https://www.ec ...
- MS Chart 条状图【转】
private void Form1_Load(object sender, EventArgs e) { string sql1 = "select 类别,coun ...
- Python数据可视化:画饼状图、折线图、圈图
前言 本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. from math import pi import matplotlib ...
- 【Matplotlib】利用Python进行绘图
[Matplotlib] 教程:https://morvanzhou.github.io/tutorials/data-manipulation/plt/ 官方文档:https://matplotli ...
随机推荐
- [NOIP2018(PJ)] 摆渡车
题目链接 题意 有 $n$ 个同学在等车,每位同学从某时刻开始等车,相邻两趟车之间至少间隔 $m$ 分钟.凯凯可以任意安排发车时间,求所有同学等车时间之和的最小值. 分析 这题首先能想到是动态规划 很 ...
- ASP.NET + MVC5 入门完整教程五 --- Razor (模型与布局)
https://blog.csdn.net/qq_21419015/article/details/80451895 1.准备示例项目 为了演示Razor,使用VS创建一个名称为“Razor”的新项目 ...
- spring_boot 加入 mybatis
第一步: <!-- mybatis启动器 自动包含jdbc所以不需要再次引入jdbc依赖 --> <dependency> <groupId>org.mybatis ...
- C++-HDU1394-Minimum Inversion Number[数据结构][树状数组]
给出0~n-1的一个排列,可以整体移动,求逆序对最小值 把数字num[i]的加入,等价于树状数组的第n-num[i]位加1 因为num[i]是第 (n-1)-num[i]+1=n-num[i]大的数字 ...
- 数位dp(Balanced Numbers )
题意:一个数,如果满足奇数的数字出现偶数次,偶数的数字出现奇数次, 就是符合的数,注比如:12313 就满足,因为1 3出现了偶数次.2出现了奇数次 思路,对于这道题,就是状态压缩加dp: 对于一个 ...
- [HDU5382]GCD?LCM!
Description HDU5382 会吗?不会! 设\(F(n)=\sum\limits_{i = 1}^{n}\sum\limits_{j=1}^{n}[lcm(i,j)+gcd(i,j)\ge ...
- 【vue】axios + cookie + 跳转登录方法
axios 部分: import axios from 'axios' import cookie from './cookie.js' // import constVal from './cons ...
- 老生常谈--Java值传递和引用传递
起因 前两天面试被问到了这个问题,虽然之前老早就了解过这个问题,但是并没有深入了解,所以面试的时候一下子慌了,菜是原罪,今天菜鸡来补补基础知识. 其实这个问题一直是被讨论的,常见的三种说法就是,1,J ...
- 【SIKI学院】愤怒的小鸟创建过程-2
第二讲:Spring joint组建介绍 点重小鸟右侧add component输入spring joint,选择spring joint 2D(弹簧关节).给右侧树枝加刚体选择physics 2D- ...
- 如何使用 idea提交svn代码
链接:https://jingyan.baidu.com/article/b2c186c80d81b1c46ff6ff59.html