2014-02-20 28 views
1

框:刪除刻度線,但保留了一些碼提供像下面上

X = 1:0.5:10
積(X,的sin(x))
設置(gca,'box','on')

我試圖讓左軸保持它的刻度標記和右軸沒有。
我知道,我不希望做到以下幾點:

集(GCA, '盒子', '關')
集(GCA, 'Ytick', '[]')%這個圈關閉左側和右側的刻度線。我只是想要脫掉它。

我真的,真的不喜歡使用plotyy。任何幫助,將不勝感激。 在這裏創建dumby軸是唯一的選擇嗎? http://www.mathworks.com/matlabcentral/newsreader/view_thread/261486

回答

1

我認爲你被卡在一個假軸(或各種更加不吸引人的選擇)。

FWIW,所需的代碼只有幾行;最短我可以得到它是:

a1 = axes('box','on','xtick',[],'ytick',[]); %Under axis, used as background color and box; 
a2 = axes();  %Over axis, used for ticks, labels, and to hold data 
propLink = linkprop([a1 a2],'position');  %Keep the positions the same 
x=1:.5:10          %Make and plot data 
plot(a2, x,sin(x)) 
set(a2,'box','off','color','none');   %Set top axes props last ("plot" overrides some properties) 
相關問題