【问题标题】:suptitle Error using axes Invalid axes handlesuptitle 使用坐标区时出错 无效的坐标区句柄
【发布时间】:2020-02-23 21:43:10
【问题描述】:

我正在尝试循环创建直方图。我正在创建两个图形并希望在它们上方添加一个字幕,但是当我这样做时,子图的标题不再起作用。这是我的代码

suptitle('Observation')
for i=1:c:b
    i
    MagObs1=[];
    subplot(b,1,i);
    MagObs1=MagObs(:,i);%0 and 1s
    minMagObs1=min(MagObs1);
    MagObs2=MagObs1(MagObs1>0.001);
    h1=histogram(MagObs2,NumberBins,'Normalization','probability');
    title([num2str(DepthObs(i)),'m']);
    h1.BinLimits=[bottomVel topVel];
    xlabel('Current speed (m/s)');
    ylabel('Frequency');
end

figure(2);% clf;
suptitle('Model')
for i=1:c:b

    subplot(b,1,i);
    
    h2=histogram(MagMatrixH1(i,:),NumberBins,'Normalization','probability')
    title([num2str(DepthObs(i)),'m'])
    h2.BinLimits=[bottomVel topVel]
    xlabel('Current speed (m/s)')
    ylabel('Frequency')
end

这是我得到的错误

Error using axes
Invalid axes handle

Error in suptitle (line 98)
axes(haold);

Error in Histogram (line 118)
suptitle('Observation')

这是我的输出。通常,每个图都有多个直方图,但在这个例子中,我只展示了一个。

正如您在第二张图片中看到的那样。 "Im" 应该是 '300m',你能帮我解决这个子图标题吗?

【问题讨论】:

  • suptitle 拥有的(非常少的)文档中,它说:“在所有子图命令之后使用这个函数。”
  • @AnderBiguri 如果我没记错的话是生物信息学工具箱

标签: matlab histogram subplot suptitle


【解决方案1】:

suptitle 拥有的(非常少的)文档中,它说:

“在所有子图命令之后使用这个函数。”

尝试在绘图末尾添加它

【讨论】:

    猜你喜欢
    • 2012-11-08
    • 1970-01-01
    • 2010-12-14
    • 2017-04-11
    • 2022-01-19
    • 1970-01-01
    • 2012-01-20
    • 2014-11-06
    • 2020-05-13
    相关资源
    最近更新 更多