在八度音程中更改图例的位置

Change position of legend in octave

我想在多个子图的下方或右侧显示图例,同时保持子图的纵横比。尝试this answer的方法,我写了下面的代码:

x = [0:0.1:10];

figure();
for i=1:4
  subplot(3,2,i);
  plot(x, x);
endfor;

hSub = subplot(3,2,5:6); 
plot(0);
hLegend = legend('1');
set(hLegend, 'position', get(hSub, 'position'));

产生:

图例应该替换完整情节 5. 我在 octave documentation 找不到 属性 position,所以它显然不起作用。

有没有办法改变图例的位置或在子图旁边打印图例的其他方法?

编辑:

我猜你想要这样的东西

x = [0:0.1:10];
figure();
for i=1:4
  subplot(3,2,i);
  plot(x, x);
endfor;

l = legend ("foobar")
hsub = subplot(3,2,5:6);
set (l, "position", get (hsub, "position"))
delete (hsub)

这给出了