【问题标题】:Matlab: Overlaying only the contour plot lines on an imagescMatlab:仅在图像上覆盖等高线图线
【发布时间】:2014-06-04 16:04:25
【问题描述】:

使用两个大小相等的矩阵,一个将某些值表示为等高线图,另一个将这些值(0 或 1 的二进制值)的统计显着性表示为 imagesc 图的灰色和白色图,我想将它们组合起来,这样我的白色和灰色图像c 图上只有(黑色)轮廓线。

所以我有两个 32x87 矩阵: 异常 测试结果

这是我的代码的相关部分:

figure
imagesc(testResults.')
colormap(gray)
colorbar
caxis([-2 1])
hold on
clabel(contour(anomaly.'))
colormap(gray)
hold off

所以一个问题是我找不到一种方法来设置轮廓线颜色的限制以保持它们全黑(因为我有 clabel,我不需要任何变化)。我遇到的另一个奇怪的问题是,如果我不使用异常(anomaly.')的转置,它就不会出现在这个图上。非常感谢任何帮助。

我尝试过使用透明度,但确实很难看到很多东西,尽管我不会排除它。

【问题讨论】:

标签: image matlab contour


【解决方案1】:

您可以通过在轮廓命令中指定 linespec 来使所有轮廓线变黑,以强制所有线条为一种。也就是说,尝试将您的轮廓命令更改为clabel(contour(anomaly.', 'k'))

像这样:

[x y] = meshgrid((1:87)/87);
testResults = sin(x).*sin(y);
anomaly = testResults;

figure
imagesc(testResults.')
colormap(gray)
colorbar
caxis([-2 1])
hold on
clabel(contour(anomaly.', 'k'))
colormap(gray)
hold off

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多