2015-04-17 74 views
1

使用我在matlab中的繪圖代碼,爲什麼仍然有問題定位xlabel?正如您在圖片中看到的那樣,我需要將XLabel.Y的位置降低-0.03。重新定位xlabels

figure; 
h2=bar([mean(o2_ExecNorm(:,:,8)-1,2) mean(o3_ExecNorm(:,:,5)-1,2)]); 
set(gca, 'XTickLabel',unique([bench.application]), 'XTick',1:numel(unique([bench.application]))) 
hold on 
axis([0 25 -0.3 2.5]) 
set(gca,'FontName','AvantGarde') 
xticklabel_rotate([],35,[]) 
set(findobj(gca,'Type','text'),'FontSize',14, 'FontWeight','Bold','FontName','courier'); 
set(gcf, 'color', [1 1 1]) 
ylabel({'Performance improvement w.r.t -O3 and -O2'},'FontSize',24,'FontWeight','bold'); 
legend({'w.r.t -O2','w.r.t -O3'}) 

顯然,這部分不工作:

vec_pos = get(get(gca, 'XLabel'), 'Position'); 
set(get(gca, 'XLabel'), 'Position', vec_pos + [0 -0.03 0]); 
set(gca,'YTickLabel', 1:.5:3) 
hold off 

enter image description here

+1

你確切的問題是什麼? –

+1

您可以嘗試在刻度標籤字符串的末尾添加一些空格。 –

+0

@ m.s。看到我更新的問題 – Amir

回答