How to plot only specific contours in matlab?

36 次查看(过去 30 天)
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