【发布时间】:2017-07-30 10:58:30
【问题描述】:
我使用以下循环来获取子图:
for j=1:19;
Aj=B(j,:);
subplot(5,4,j);
plot(Aj,h)
end
对于所有这些子图,我只需要一个 x-label 和一个 y-label。这个怎么做?另外如何将图例插入所有子图?
【问题讨论】:
标签: matlab matlab-figure axis-labels axes subplot
我使用以下循环来获取子图:
for j=1:19;
Aj=B(j,:);
subplot(5,4,j);
plot(Aj,h)
end
对于所有这些子图,我只需要一个 x-label 和一个 y-label。这个怎么做?另外如何将图例插入所有子图?
【问题讨论】:
标签: matlab matlab-figure axis-labels axes subplot
您可以使用 FileExchange 中的suplabel 为所有子图组合 x 和 y 标签。
示例:
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');
输出:
使用suplabel时,有时你必须最大化图形窗口才能看到xlabel。
【讨论】: