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 ...
随机推荐
- layui下select禁止点击
layui下拉选择框select禁止点击_设置禁用_设置不可操作的实现方法 直接上代码: <form class="layui-form"> <!-- 提示:如果 ...
- python console的命令执行
命令 from app01 import models models.UserInfo.objects.all()查询出所有内容
- vue + elementui表单重置 resetFields问题(无法重置表单)
问题: elementui在重置表单时,无法使用this.$refs['formRefVal'].resetFields()清空表单数据; elementui 设置rules后没有效果 解决方法: 1 ...
- 题解【UVA12003】Array Transformer
题目描述 输入输出格式 输入格式 输出格式 输入输出样例 输入样例#1 10 1 11 1 2 3 4 5 6 7 8 9 10 2 8 6 10 输出样例#1 1 2 3 4 5 6 7 8 9 6 ...
- 【资源分享】Gmod自由移动镜头脚本
*----------------------------------------------[下载区]----------------------------------------------* ...
- shiro登录认证过程讲解
先粘出登录的代码 1. 可以看到已经获取到了username和password ,为了接下来的认证过程,我们需要获取subject对象,也就是代表当前登录用户,并且要将username和passw ...
- 离线安装requests库
离线安装需要五个 certifi-2019.9.11-py2.py3-none-any.whl chardet-3.0.4-py2.py3-none-any.whl idna-2.8-py2.py3- ...
- css之变形(transform)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Python偶斐波那契数
斐波那契数列中的每一项都是前两项的和.由1和2开始生成的斐波那契数列前10项为 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … 考虑该斐波那契数列中不超过四百万的项,求其中为 ...
- 联网调试DE1
步骤:打开PUTTY,com3,串口,115200 重启开发板, 输入root, 输入 cd /mnt 输入 ifconfig 尝试一下自动分配网址:udhcpc 网络直连失败,原因占时不知 ...