Contourf colour doesn't display correct values.

I have a contourf plot shown below, the problem I'm having is that the ring is supposed to be almost white; the values in the matrix I'm plotting are all between 50 and 60. Where as the current corresponding colour is seemingly between -50 and -60. I've plotted it using the following code:
contourf(x_axis, y_axis,P_INDEX)
colormap(hot)
colorbar
caxis([-60 60])
I've also tried plotting it using abs(P_INDEX) but it gives the same output. Does anyone know what the issue could be?

 채택된 답변

ANKUR KUMAR
ANKUR KUMAR 2018년 1월 1일

0 개 추천

I have tried to plot the similar contour using your program and I am getting the correct contour.
P=randi(60,20,30);
P(P<50)=52;
contourf(P)
colormap(hot)
colorbar
caxis([-60 60])
I think, there might be some mistake in P_INDEX values. I request you to cross check (manually) the P_INDEX values. This could be the error..
If your problem is not resolved yet, then please attach the .mat file which contains P_INDEX, y_axis and x_axis.

댓글 수: 6

mathman
mathman 2018년 1월 1일
I've attached the files you've asked for. I've checked the P_INDEX values aswell, and they are all positive.
ANKUR KUMAR
ANKUR KUMAR 2018년 1월 1일
편집: ANKUR KUMAR 2018년 1월 1일
((length(find(P_INDEX>50)))/(numel(P_INDEX)))*100;
Only 0.39 percent of the values are above 50. Moreover, these values are already plotted in between the black line. Zoom your figure and you will get your answer.
mathman
mathman 2018년 1월 1일
Ah okay. I'm still not sure what the black line represents though. The surrounding values of the 0.39% are all zero so they should be orange. Is the black line only there to outline where the values are? If so is it possible to remove it?
Firstly, see this picture. This is the zoomed part of the black line.
In between of the black line, there are patches of values between 20-30. And when you plot these all in the very small figure window, then all colors mixes up and seems to be dark black line.
If you suppress your colorbar to to caxis([0 60]), then you can see the white pathes.
You can see the white patches. If you zoom it more the white line, you will get the figure which I have attached first in this comment.
Plot this one and see the graph.
contourf(P_INDEX(150:155,280:300))
mathman
mathman 2018년 1월 1일
Oh I see what you mean. Thanks for the help.

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

추가 답변 (0개)

카테고리

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

태그

질문:

2018년 1월 1일

댓글:

2018년 1월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by