Hello everyone!
I appointed the contour level to the minimum value and 0.1 (code below) but in some I get only 0.1 without the minum value. I checked the code, the minimum value is generated everytime bu clabel is not taking it.
(nevermind the dataname, I have delited some parts to keep the privicy)
Please help. Thanks
dataname={'m' 'p' 't' 's' 'C' 'e' 'a' 'D' 'O' };
paramX=coefA;
paramY=coefB;
paramZ=deviNnorm;
paramZ(paramZ==0)=nan;
rowNum=3;
colmNum=3;
fig=figure('color','w');
for pp=1:rowNum*colmNum
subplot (rowNum,colmNum,pp)
[C,h] =contour(paramX,paramY,squeeze(paramZ(pp,:,:)),[0.01:0.01:0.1,0.2:0.4:1],'ShowText','on');hold on; plot(paramX,flip(paramY),'--','color','r');hold off
shows=[round(min(min(squeeze(paramZ(pp,:,:)))),2) 0.1];
clabel(C,h,shows,'FontWeight','bold')
axis([0 1 0 1])
title(dataname(pp))
view (0,90);
end

 채택된 답변

Asliddin Komilov
Asliddin Komilov 2022년 5월 7일

0 개 추천

I have changed the part of the code, but still don't see my minima:
for pp=1:rowNum*colmNum
subplot (rowNum,colmNum,pp)
Zmins=min(min(squeeze(paramZ(pp,:,:))));
[C,h] =contour(paramX,paramY,squeeze(paramZ(pp,:,:)),[Zmins:0.01:Zmins+0.01,0.1:0.1:1],'ShowText','on');hold on; plot(paramX,flip(paramY),'--','color','r');hold off
h.LevelList=round(h.LevelList,4);
shows=[Zmins 0.1 0.2 0.4 0.6 0.8];
clabel(C,h,shows,'FontWeight','bold','LabelSpacing',300)
axis([0 1 0 1])
title(dataname(pp))
view (0,90);
end
HELP! PLEASE! HELP!

댓글 수: 1

Asliddin Komilov
Asliddin Komilov 2022년 5월 8일
it is just a guess, but some mimima are just spots and labels don't fit in them, it could be the reason why I matlab doesn't generate them.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Riccardo Scorretti
Riccardo Scorretti 2022년 5월 7일
편집: Riccardo Scorretti 2022년 5월 7일

0 개 추천

Hi Asliddin,
the problem is that in your own data sometimes the value for which you wish to plot the isovalue does not exist. See this modified version of your program:
load counttest.mat
dataname={'m' 'p' 't' 's' 'C' 'e' 'a' 'D' 'O' };
paramX = coefA;
paramY = coefB;
paramZ = deviNnorm;
paramZ(paramZ==0) = nan;
rowNum = 3;
colmNum = 3;
fig = figure('color','w');
iso = [0.01:0.01:0.10 , 0.2:0.4:1.0];
for pp = 1 : rowNum*colmNum
tmp_ = squeeze(paramZ(pp,:,:));
subplot (rowNum, colmNum, pp)
[C,h] = contour(paramX, paramY, tmp_, iso, 'ShowText', 'on');
hold on; plot(paramX, flip(paramY), 'r--'); % hold off
minval = round(min(tmp_(:)), 2);
shows = [minval 0.1];
if min(tmp_(:)) > shows(1)
fprintf('*** pp = %i : The required value %f doesn''t exist (min = %f) ***\n', ...
pp, shows(1), min(tmp_(:)));
end
clabel(C, h, shows, 'FontWeight', 'bold');
axis([0 1 0 1]);
% title(dataname(pp));
title(num2str(pp));
view (0,90);
end
*** pp = 3 : The required value 0.080000 doesn't exist (min = 0.083007) *** *** pp = 4 : The required value 0.040000 doesn't exist (min = 0.041459) *** *** pp = 5 : The required value 0.080000 doesn't exist (min = 0.083171) *** *** pp = 6 : The required value 0.020000 doesn't exist (min = 0.020750) *** *** pp = 8 : The required value 0.020000 doesn't exist (min = 0.022502) *** *** pp = 9 : The required value 0.010000 doesn't exist (min = 0.012640) ***
The program displays only the isoline corresponding to the value 0.1 in all graphics from 3 to 9. You cannot plot an isovalue corresponding to a value which is less than the minimum (or higher than the maximum) of your data.

댓글 수: 1

Asliddin Komilov
Asliddin Komilov 2022년 5월 7일
편집: Asliddin Komilov 2022년 5월 7일
Hi,
I have added:
digits(2);
paramZ=vpa(paramZ);
paramZ=single(paramZ);
why your code is giving the same error, where it is getting the 3rd digit out of paramZ?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by