如何在MATLAB中为4个子图创建一个通用图例? [英] How to create one common legend for 4 subplots in MATLAB?
本文介绍了如何在MATLAB中为4个子图创建一个通用图例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在MATLAB中为4个子图创建一个通用图例,如下所示:
How can I create one common legend for 4 subplots in MATLAB, like this:
推荐答案
又快又脏:
hSub = subplot(3,1,1); plot(1,1,1,1,1,1,1,1);
hLegend = legend('hello','i','am','legend');
subplot(3,2,3), plot(10:-1:1); subplot(3,2,4), plot(1:100);
subplot(3,2,5), stem(1:10); subplot(3,2,6), plot(randn(1,100))
set(hLegend, 'position', get(hSub, 'position'));
这篇关于如何在MATLAB中为4个子图创建一个通用图例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文