How to have a common label for all x and y axes in case of subplots?

纵然是瞬间 提交于 2019-12-02 03:52:27

You can use suplabel from the FileExchange to have combined x and y label for all subplots.

Example:

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');

Output:


Sometimes you have to maximize the figure window to see the xlabel when using suplabel.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!