MATLAB Answers

How to limit the contour plot to specific points?

56 ビュー (過去 30 日間)
Philippe Corner
Philippe Corner 2018 年 10 月 30 日
コメント済み: Star Strider 2018 年 10 月 30 日
How could I plot contour until the toppest scatter points?

  0 件のコメント

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

採用された回答

Star Strider
Star Strider 2018 年 10 月 30 日
See the documentation on Contours at One Level (link) in the contour (link) documentation.

  4 件のコメント

表示 1 件の古いコメント
Star Strider
Star Strider 2018 年 10 月 30 日
You can set the contour levels you want as the third argument to contour or contourf:
[X,Y,Z] = peaks;
contourf(X,Y,Z, [0 : 7])
This creates and draws the contours from 0 to 7 for that function. Those less than or equal to 0 are white, those greater than equal to 7 are all colored with the color for 7.
Philippe Corner
Philippe Corner 2018 年 10 月 30 日
Not sure why is not working. I had to create my contour using a matrix
[c,h]=contourf(xq,yq,reshape(zq,100,100));
Star Strider
Star Strider 2018 年 10 月 30 日
I cannot determine the reason it is not working without your data and code. The first two arguments can be vectors or matrices, the third must be a matrix. The dimensions must match in any event.
Apparently your reshape call solved the problem.

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by