How to plot only specific contours in matlab?

19 ビュー (過去 30 日間)
Ivan Mich
Ivan Mich 2022 年 7 月 7 日
回答済み: dpb 2022 年 7 月 7 日
Hello,
I would like to ask about contours plot in matlab. I would like to plot only specific contours of all my data. I have values ranrging from 10 to 10000. I would like to plot only the contousr with va;lues : 10, 100, 500, 1000 and 100000.
I am using these commands
t=importdata('input.txt');
x=t(:,1);
y=t(:,2);
z=t(:,5);
[xi, yi] = meshgrid(...
linspace(min(x),max(x)),...
linspace(min(y),max(y)));
zi = griddata(x,y,z, xi,yi,'natural');
figure(1)
contourf(xi,yi,zi,15,'LineStyle','none')
set(gca,'ColorScale','log')
colormap(flipud(hot(50)))
Could you please help me?

採用された回答

dpb
dpb 2022 年 7 月 7 日
Did you not read contourf input syntax descriptions?
The third option down says
contourf(___,levels) specifies the contour lines to display as the last argument in any of the previous syntaxes. ... To draw the contour lines at specific heights, specify levels as a vector of monotonically increasing values. ...
Emphasis added, n levels and one level only options elided for brevity -- dpb

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