【发布时间】:2015-10-06 12:57:24
【问题描述】:
请看附图
我在python中有如下源代码
def plotBarChartH(self,data):
LogManager.logDebug('Executing Plotter.plotBarChartH')
if type(data) is not dict:
LogManager.logError('Input data parameter is not in right format. Need a dict')
return False
testNames = []
testTimes = []
for val in data:
testNames.append(val)
testTimes.append(data[val])
matplotlib.rcParams.update({'font.size': 8})
yPos = np.arange(len(testNames))
plt.barh(yPos, testTimes, height=0.4, align='center', alpha=0.4)
plt.yticks(yPos, testNames)
plt.xlabel('time (seconds)')
plt.title('Test Execution Times')
savePath = os.path.join(ConfigurationManager.applicationConfig['robotreportspath'],'bar.jpg')
plt.savefig(savePath)
plt.clf()
return True
栏看起来不错,但我有两个问题
y轴上的文字如何才能完整显示?我的意思是有些文本被截断了,我想扩展占用的空间,以便它可以完整显示。
我可以增加绘制图表的整个绘图区域吗?我想增加绘图区域的宽度,使图像看起来更大
谢谢
【问题讨论】:
标签: python matplotlib