如何在matlab中填充轮廓之间的颜色

时间:2013-07-17 19:17:19

标签: matlab colors contour

我使用MatLab的轮廓功能,使用hold on命令在matlab中绘制了多个轮廓。如果我想在第一个和最后一个轮廓之间填充颜色,我该怎么办?我试过了contourf函数,但它并没有那么成功。

提前致谢。

我编写了两条简单的线条,在每次迭代后绘制零水平集轮廓。

      hold on;
      contour(X,Y,phi,[0,0],'r');

1 个答案:

答案 0 :(得分:0)

这可以通过使用get命令从图中获取单个组件来完成。例如:

[x, y, z] = peaks; % Generate some data
figure; surf(x, y, z); % Show
figure;[c, h] = contourf(x, y, z, [0 0]); % Build and show contour plot
patches = get(h, 'children'); % Get different patches
set(patches(1), 'facecolor', 'r') % Colour one red
相关问题