How to color a matrix based on the values in matlab?

123 vues (au cours des 30 derniers jours)
Mr. 206
Mr. 206 le 14 Déc 2018
Commenté : Adam Danz le 17 Déc 2018
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]

Réponse acceptée

Adam Danz
Adam Danz le 14 Déc 2018
Modifié(e) : Adam Danz le 14 Déc 2018
heatmap(A)
xlabel('column number')
ylabel('row number')
181214 095536-Figure 1.jpg
  9 commentaires
Mr. 206
Mr. 206 le 17 Déc 2018
@Adam I increased the row sizes.
@Image Analyst Hm, I think so.
Adam Danz
Adam Danz le 17 Déc 2018
I also agree with Image Analyst.
Here are some possible solutions
  1. just to expand the horizontal size of the figure.
  2. rotate your matrix if there are much less columns than rows.
  3. round your values so they only have 1 decimal place - that will make shorter strings.
  4. just use the color bar to estimate the value of each cell.

Connectez-vous pour commenter.

Plus de réponses (1)

Image Analyst
Image Analyst le 14 Déc 2018
Sounds like a Yair Altman question.
See his web site: Coloring cells in a uitable

Catégories

En savoir plus sur Data Distribution Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by