【问题标题】:Change position of legend in octave以八度音阶更改图例的位置
【发布时间】:2018-05-12 05:53:54
【问题描述】:

我想在多个子图的下方或右侧显示一个图例,同时保持子图的纵横比。尝试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,所以它显然不起作用。

有没有办法改变图例的位置或另一种方法来打印子图旁边的图例?

编辑:

  • 八度版本:4.0.3 GUI
  • 操作系统:Opensuse 42.2
  • graphics_toolkit:用gnuplotfltkqt测试

【问题讨论】:

    标签: octave legend subplot


    【解决方案1】:

    我猜你想要类似的东西

    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)
    

    给了

    【讨论】:

    • 没错。谢谢!这适用于我的fltkqt。知道为什么它不适用于gnuplot吗?
    • @Marph:FLTK 和 Qt 后端都共享 GNU Octave 中的 opengl 渲染器的很大一部分,它们仅在查看部分和 HMI 上有所不同
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-11
    • 2020-12-31
    • 2015-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多