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!