2017-03-09 4 views
1

:すべてのこれらのサブプロットのためにサブプロットの場合、すべてのx軸とy軸に共通のラベルを付けるにはどうすればよいですか?私はサブプロットを取得するには、次のループを使用している

for j=1:19; 
    Aj=B(j,:); 
    subplot(5,4,j); 
    plot(Aj,h) 
end 

を、私は一つだけのxのラベルと1点のyラベルを持っている必要があります。これを行う方法?また、凡例をすべてのサブプロットに挿入する方法は?

答えて

2

あなたは、すべてのサブプロットのためのXYラベルを組み合わせたとFileExchangeからsuplabelを使用することができます。

例:

subplot(1,2,1); 
plot(randperm(40)); hold on; plot(randperm(40)); %Plotting some random data 
legend('show') %To show the legend 

subplot(1,2,2); 
plot(randperm(40)); hold on; plot(randperm(40)); %Plotting some random data 
legend('show') %To show the legend 

%Using suplabel from the FileExchange to give a single x and y label for all subplots 
suplabel('Combined X label','x'); 
suplabel('Combined Y label','y'); 

出力:

outputsuplabel


ときにはとき、私たちは、xlabelを見るためにfigureウィンドウを最大化しなければなりませんsuplabel

関連する問題