필터 지우기
필터 지우기

how to extract colour percentages of contour plot

조회 수: 7 (최근 30일)
laxminarayana pasupuleti
laxminarayana pasupuleti 2017년 7월 1일
댓글: Image Analyst 2017년 7월 1일
hi, output of my data set is 5x15 matrix, with this a contourf was plotted. the plot displays differnt colous since i used contourf command. so, i would like to know percentage of each colour which present in the plot, i tried using impixel command.but i failed to use this command. is there any other way to use .. please help me...

답변 (2개)

Walter Roberson
Walter Roberson 2017년 7월 1일
You could do a screen capture and have it do calculations on the color image you obtained that way.
Consider the possibility that you do not really care what the colors are, and that instead what you want to know is the area occupied by each contour level. That is a different question which can be answered by using histcounts() with your data and the vector of the contour levels
  댓글 수: 2
laxminarayana pasupuleti
laxminarayana pasupuleti 2017년 7월 1일
yes sir, my main aim is to know the area occupied by each contour level. can you please elaborate how to use histcounts() which you said above..
Image Analyst
Image Analyst 2017년 7월 1일
I agree, histcounts() is most likely what you're needing. Did you see the documentation?
[counts, binEdges] = histcounts(data, binEdges);
is one way to call it. There are several ways it can be used. Just look in the help.

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


Star Strider
Star Strider 2017년 7월 1일
To get the area occupied by each contour level, it might be easier to use the 'ContourMatrix' (link) property of contourf. (See the documentation on Contour Properties (link) for details.) You will have to search through the vectors for the individual levels, since they define the beginning of each contour (x,y) matrix. Getting those from the 'LevelList' (link) property first makes this easier. Then use the trapz (link) function to do the integration.
Note that you need to integrate all the contours and then subtract the areas of the inner contours to get the correct values of the outer contours.
This is not difficult, but does require some programming. Since the (x,y) contour matrices are not all the same lengths, use a cell array to store them. (You will need to loop through them to isolate all of them first.)

카테고리

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