How do you plot a line on a function defined by colors?

1 次查看(过去 30 天)
Hello, I want to plot a line on a color defined function (enclosed example below), such that the line follows the boarders between colors. I don't want to plot a line that roughly follows the color boarders but follows the boarder exactly based on the change in color. However, I am unsure how to acomplish this. Any help appreciated.
Example:
  3 个评论
Lulu
Lulu 2023-10-19
It is an imagesc(). The underlying data has sharp data boudaries.
Dyuman Joshi
Dyuman Joshi 2023-10-19
Could you attach the data? Use the paperclip button to attach.

请先登录,再进行评论。

回答(3 个)

KSSV
KSSV 2023-10-19
[X,Y,Z] = peaks(100) ;
contourf(X,Y,Z)

Voss
Voss 2023-10-19
img = imread('image.png');
imagesc(img)
hold on
contour(mean(img,3),'k')

Walter Roberson
Walter Roberson 2023-10-19
levels = unique(YourData);
contourf(YourData, levels);

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by