Highlight a specific contour level in contour plot?

25 ビュー (過去 30 日間)
Madan Kumar
Madan Kumar 2021 年 2 月 2 日
コメント済み: Madan Kumar 2021 年 2 月 2 日
Hi,
I have a contour plot and I want to highlight only a selected contour level. How can I do it? I tried all techniques reported but no success.
my code is follows and I want to highlight contour only with levels equal to 0 (zero). Can anyone help me out. Thank you. I am using matlab2015a.
z=load('data.txt');z=round(z);
x=1:0.1:9.1;
y=80:0.5:115;
[C,h] = contourf(x,y,x);
colorbar;
thisH = findall(h,'Userdata',0.0);
set(thisH,'linewidth',5)

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 2 月 2 日
The simplest way might just be to add an separate contour:
[C,h] = contourf(peaks(123));
hold on
emphasis_level = 0;
contour(peaks(123),[1 1]*emphasis_level,'k','linewidth',2);
HTH
  6 件のコメント
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 2 月 2 日
編集済み: Bjorn Gustavsson 2021 年 2 月 2 日
Yes. In my first example peaks has values safely above and below zero. In your example M has extreme-values exactly at zero. Then you will just not get a contour at that level, it might be a requirement that M has values above and below a contour-level to actually make a contour, think about this the way of a topographic map, for a contour to be meaningfull the topography has to be above that level on one side and lower on the other. My interpretation is that the reason you get no contour just at zero in your example is an unrelated problem to the highlighting question.
Madan Kumar
Madan Kumar 2021 年 2 月 2 日
got it..thank u..

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by