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 ...
随机推荐
- elementui el-table根据分页显示表格序号
每页显示的序号都是一样的: <el-table :data="tableData" highlight-current-row @current-change="h ...
- android button setMinHeight setMinWidth 无效解决办法
setMinWidth(0);setMinHeight(0);setMinimumWidth(0);//必须同时设置这个setMinimumHeight(0);//必须同时设置这个 两个方法同时设置才 ...
- bitlocker对磁盘进行加密解密
1,bitlocker是什么? BitLocker即Windows BitLocker驱动器加密.是微软在Windows Vista中新增的一种数据保护功能.使用BitLocker可以加密磁盘.主要用 ...
- asp.net使用wsdl文件调用接口,以及调用SSL接口报错“根据验证过程 远程证书无效”的处理
1.调用wsdl接口,首先需要将wsdl文件转换为cs文件: 进入VS 开发人员命令提示行,输入如下命令: c:/Program Files/Microsoft Visual Studio 8/VC& ...
- blur()低通滤波
blur()函数可以用标准化的盒式过滤器来平滑图像. C++ API: 相关官网资料: https://docs.opencv.org/3.4.1/d4/d86/group__imgproc__fil ...
- AcWing 908. 最大不相交区间数量
//1.将每个区间按右端点从小到大排序 //2.从前往后依次枚举每个区间,如果当前区间中已经包含点,就直接跳过,否则,选择当前区间的右端点 //选右端点的话,可以尽可能的包含在多个区间里 //那么选的 ...
- Django_后台管理
1. 站点管理 2. 创建超级管理员 3. 添加自己的数据模型 默认是打印字符串的 4. 个性化站点管理的定制 4.1 个性化规则 admin.py 4.2 布尔值定制显示 4.3 插入班级的时候同时 ...
- Python记:索引操作示例:将以数指定年,月,日的日期打印出来
————————————————————————————————————不要停止奔跑,不要回顾来路,来路无可眷恋,值得期待的只有前方. months=[ 'January', 'February', ...
- STA 开篇
时序分析=动态时序分析+静态时序分析 动态时序分析简单讲就是gate-level simulation,仿真对象是netlist+sdf,通过SDF反标,得到gate跟net的delay,通过输入大量 ...
- Linux中内容查看命令"大PK"
众所周知linux中命令cat.more.less均可用来查看文件内容,当然还有我们"非主流"的vim以及使用较少的head.tail.tac. 下面我将介绍各种命令的用法及对比. ...