Plot only certain contours

94 ビュー (過去 30 日間)
William White
William White 2018 年 2 月 1 日
コメント済み: Matt J 2018 年 2 月 1 日
Sirs, I am plotting a contour plot of data
contourf(X,Y,Z)
Say the values of Z range from 0 to 100 (or say, -100 to 100 for another example).
I can overlay the contour values
hold on
[C,h] = contour(X,Y,Z);
clabel(C,h)
Is it possible to only plot the entire contourf(X,Y,Z) so it is a full contour map
but then only plot the iso-contour lines for particular values?
So, I might want to over-plot only the isocontour that has value 20?
Or, more usefully, say, 20,30 and 40?
kind regards

採用された回答

Matt J
Matt J 2018 年 2 月 1 日
編集済み: Matt J 2018 年 2 月 1 日
From the doc:
contourf(Z,v) draws a filled contour plot of matrix Z with contour lines at the data values specified in the monotonically increasing vector v. To display a single contour line at a particular value, define v as a two-element vector with both elements equal to the desired contour level.
Is this not what you want?
  3 件のコメント
Matt J
Matt J 2018 年 2 月 1 日
編集済み: Matt J 2018 年 2 月 1 日
I'm still not sure I see the problem. Why not as follows?
contourf(X,Y,Z)
hold on
[C,h] = contour(X,Y,Z,[20,30,40]);
clabel(C,h)
hold off
Matt J
Matt J 2018 年 2 月 1 日
William White commented:
Hi Matt, I think the problem is that I was unaware that the selected values could be inserted like that! thanks a lot, much appreciated! W

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

その他の回答 (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