python条形图一直长_Python MatPlotlib条形图调整宽度

我画了3个条形图,问题解决了。在import matplotlib.pyplot as plt;plt.rcdefaults()

from numpy.random import rand

from numpy import arange

import numpy as np

def libra_execution_time():

data = np.genfromtxt('C:\\programming\\Python27\\libra_graphs\\File\\histogram.csv',delimiter=',')

hash_diff,key_diff,binary_diff = 0,0,0

hash_time_lst,key_time_lst,binary_time_lst = [],[],[]

for row in data:

if not np.isnan(row[7]):

hash_diff = row[7]-hash_diff

hash_time_lst.append(hash_diff)

for row in data:

if not np.isnan(row[8]):

key_diff = row[8]-key_diff

key_time_lst.append(key_diff)

for row in data:

if not np.isnan(row[9]):

binary_diff = row[9]-binary_diff

binary_time_lst.append(binary_diff)

print "#Hash Partitioner ->" ,hash_time_lst,len(hash_time_lst)

print "#Key Field Partitioenr ->", key_time_lst,len(key_time_lst)

print "#Binary Partitioner ->",binary_time_lst,len(binary_time_lst)

#x_lst = (hash_time_lst + key_time_lst + binary_time_lst)

#print x_lst

job_time = {"Hash Time":hash_time_lst,"Key_Time":key_time_lst,"Binary Time":binary_time_lst}

print job_time

print job_time.keys(),job_time.values()

y_pos = np.arange(len(job_time.values()))

print "Y position",y_pos

val = np.array(job_time.values())

print val

plt.barh(y_pos,val ,align='center',height = 0.5 ,color=('r','y','g'))

plt.yticks(y_pos,job_time.keys())

plt.xlabel('Time(seconds)')

plt.ylabel('Performance ->')

plt.title('Job Execution LIBRA')

plt.show()

libra_execution_time()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值