如何在MATLAB中为4个子图创建一个通用图例?

时间:2014-11-02 21:46:36

标签: matlab legend subplot

如何在MATLAB中为4个子图创建一个通用图例,如下所示:

enter image description here

1 个答案:

答案 0 :(得分:2)

又快又脏:

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

enter image description here