Contour lines on a imagesc plot

34 ビュー (過去 30 日間)
Auryn_
Auryn_ 2017 年 1 月 18 日
コメント済み: Star Strider 2017 年 1 月 18 日
Hi,
I am plotting a imagesc with (x, y, Z). On top of that I would like to plot the contour lines with constant values of z. Could you please help me with it? Thanks a lot in advance.

回答 (1 件)

Star Strider
Star Strider 2017 年 1 月 18 日
There is not enough information in your Question to provide a definite Answer.
Two possibilities:
  1. Use imagesc, hold, and contour;
  2. Use the contourf (fills the contours) function only on (x,y,z).
  2 件のコメント
Auryn_
Auryn_ 2017 年 1 月 18 日
Hi, thanks for your reply. In the resulting plot using imagesc i see the shaded plot of the variable z. Let's imagine that z is going from 0 to 100. I would like to see additional lines indicating where I have a specific and constant value of z (e.g. z=0.1, z=0.2..). Can you help me?
Star Strider
Star Strider 2017 年 1 月 18 日
You can specify the contour line locations in contour and contourf:
contour(x, y, z, [0.1 0.2 0.3 0.4])
Extend the vector (or use the colon operator or linspace to create an equally-spaced vector) to as many contour lines as you want,at whatever level you want. Contour lines that are out-of-range will of course not be plotted, but they will not throw an error.
See the contour documentation for details.

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

カテゴリ

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