請參見附件圖像如何y的在BARH蜱擴展空間 - 蟒蛇matplotlib
我源代碼在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軸上的文字如何顯示在充分?我的意思是一些文本被截斷,我想擴大佔用空間,以便可以全部顯示。
我可以增加繪製圖表的整個繪圖區嗎?我想增加繪圖區的寬度,使圖像看起來有點大
感謝
嗨,數組代表[0.2,0.1,0.9,0.9]是什麼?我在玩弄價值觀,但無法理解他們的實際表現。 – slysid
它表示xmin,ymin,xmax和ymax的歸一化值。因此,如果使用0,0,1,1則沒有餘量,如果使用0.1,0.1,0.9,0.9,則在軸和圖形邊界之間的每邊都留有10%,... – kikocorreoso