为什么情节隐藏在Octave中的另一个情节? [英] Why does Plot hide another Plot in Octave?

查看:16
本文介绍了为什么情节隐藏在Octave中的另一个情节?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Octave中的图形用户界面绘制三个Y轴和一个X轴。 我的问题是,一个阴谋隐藏着另一个阴谋。事实上,它应该显示每一个图表。但它只显示了我的最后一个代码。我使用 hold on hold off代码来显示多个y图。但它不是这样工作的e.

我的绘图代码如下所示。

h1 = axes ('position', [0.45 0.25 0.5 0.5], 'tag', 'plotarea','ycolor','r'); 
      plot( h1, XData, YData, 'tag', 'plotobject','color','r');
      hold on
h2 = axes ('position', [0.45 0.25 0.5 0.5], 'tag', 'plotarea_1','ycolor','b'); 
      plot( h2, XData, Y_1Data, 'tag', 'plotobject_1','color','b') 
      hold on
h3 = axes ('position', [0.45 0.25 0.5 0.5], 'tag', 'plotarea_2','ycolor','k');
      plot( h3, XData, Y_2Data, 'tag', 'plotobject_2','k');
      hold off
      grid on
  endfunction

任何感谢的帮助,或关于在哪里查找的提示。

推荐答案

对于第一个轴之后的轴,将color属性设置为none,将nextplot属性设置为add

h1 = axes ('position', [0.45 0.25 0.5 0.5], 'tag', 'plotarea','ycolor','r'); 
    plot( h1, XData, YData, 'tag', 'plotobject','color','r');

% either after creating the axes:
h2 = axes ('position', [0.45 0.25 0.5 0.5], 'tag', 'plotarea_1','ycolor','b', 'color', 'none');
    set(gca, 'nextplot', 'add')
    plot( h2, XData, Y_1Data, 'tag', 'plotobject_1','color','b')

% or while creating the axes:
h3 = axes ('position', [0.45 0.25 0.5 0.5], 'tag', 'plotarea_2','ycolor','k', ...
   'color', 'none', 'nextplot', 'add');
    plot( h3, XData, Y_2Data, 'tag', 'plotobject_2','k');
    grid on

这篇关于为什么情节隐藏在Octave中的另一个情节?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆