How to plot only specific contours in matlab?

조회 수: 37 (최근 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 CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by