在MATLAB中的现有图上叠加/绘图[重复]

问题描述 投票:1回答:1

我有一个由MATLAB中的“pcolor”生成的值的热图。我想在其上绘制一条线图。

我还没有找到适当的解决方案。

以下代码生成“热图”类型的输出

 hc = pcolor(middle_long, middle_height, middle_no2);
 set(hc, 'Edgecolor', 'none');
 c = colorbar;
 caxis([0 0.015]);
 axis([min(middle_long(:,1)) max(middle_long(:,1)) 0 1000])

以下代码生成线图

 plot(longflag, hflag)

以下是我想加入的各个情节类型的数字,以及我之后列出的最终产品的“示例”:

enter image description here

enter image description here

enter image description here

matlab plot figure
1个回答
2
投票

尝试这样的事情。注意hold on部分,它阻止plot删除pcolor生成的图像:

pcolor(rand(10))
colormap bone
axis xy
hold on
plot([1 10], [10 1], 'r')

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.