2011-07-04 65 views
2

我用下面的代碼:Matlab的:Y-標籤不小的數字窗口中顯示

x = linspace(0, 9, 10); 
y1 = x; 
y2 = x.^2; 
y3 = x.^4; 

myfig = figure('Position', [500 500 400 320]); %[left, bottom, width, height]: 
ax1 = gca; 
hold on 
p1 = plot(x,y1,'x--r'); 
p2 = plot(x,y2,'*-b'); 

xlabel('blaaa'); 
ylabel('fooo'); 
xlim([0 max(x)]); 
ax2 = axes('Position',get(ax1,'Position'),... 
     'XAxisLocation','top',... 
     'YAxisLocation','right',... 
     'Color','none',... 
     'XTickLabel', [],... 
     'XColor','k','YColor','k'); 
ylabel(ax2, 'asdasd'); 
linkaxes([ax1 ax2],'x'); 
hold on 
p3 = plot(x,y3,'s:g','Parent',ax2); 

legend([p1 p2 p3], {'one', 'two', 'three'}, 'Location', 'NorthWest'); 

,而右邊的Y標籤心不是顯示:有沒有辦法通過降低要麼顯示它左邊緣和左邊Y標籤之間的邊距還是通過減小實際繪製數據的寬度而不調整數字窗口的大小?

感謝

編輯:添加了一個形象:

enter image description here 要麼減少紅保證金或「綠色」的大小,因爲wherre藍色箭頭是,在y標籤現在顯示了因爲它不適合!

+0

我不想運行代碼。你能添加一個數字嗎? – 2011-07-04 19:16:33

+0

@ d00b:我增加了一個,預先感謝! – tim

回答