How to color a matrix based on the values in matlab?
조회 수: 77 (최근 30일)
이전 댓글 표시
I have a matrix of 9 by 5. I want to colur them in a table so that the higher values got red and the lowest got yellow. The intermediates are needed to be coloured with much less intense colours. So that i can just look into the colured table and can find the extreme values.
Here is a sample matrix
A = [0.7637612466433112,1.1142257017424961,0.2706813336848490,0.6354189964764154,30.6379671624144230,11.8049168799568474,15.7338944060010970,18.0052089219629146,1.5550130243814884
1.0337160657834659,0.9053961299782572,0.0959387221794711,1.2755128591866434,20.2782302123378209,3.3596928189626372,12.8964470817516776,7.8209674022748219,14.7130990449859755
1.0352868473067149,0.8237493570972951,0.6293715485887250,1.4946974606102095,35.3716291208025027,15.1388369125029829,20.4467327402212398,21.3267519051622365,9.5896087462786550
0.7598211259414681,0.6380203614898264,0.6356153065462685,1.8656794106933650,28.7986725951837208,12.1863561285026893,17.7283779444741967,8.2495858566589177,0.5313099762536371
0.9218612009686062,0.8860241669143043,0.2169698158710809,0.4690154360645855,23.0655895502382933,11.7899831056826532,16.1005856458353982,19.3146346480949731,7.7749477864298164]
댓글 수: 0
채택된 답변
Adam Danz
2018년 12월 14일
편집: Adam Danz
2018년 12월 14일
heatmap(A)
xlabel('column number')
ylabel('row number')
댓글 수: 9
Adam Danz
2018년 12월 17일
Here are some possible solutions
- just to expand the horizontal size of the figure.
- rotate your matrix if there are much less columns than rows.
- round your values so they only have 1 decimal place - that will make shorter strings.
- just use the color bar to estimate the value of each cell.
추가 답변 (1개)
Image Analyst
2018년 12월 14일
Sounds like a Yair Altman question.
See his web site: Coloring cells in a uitable
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!