![181214 095536-Figure 1.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/199034/181214%20095536-Figure%201.jpeg)
How to color a matrix based on the values in matlab?
42 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mr. 206
el 14 de Dic. de 2018
Comentada: Adam Danz
el 17 de Dic. de 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]
0 comentarios
Respuesta aceptada
Adam Danz
el 14 de Dic. de 2018
Editada: Adam Danz
el 14 de Dic. de 2018
heatmap(A)
xlabel('column number')
ylabel('row number')
![181214 095536-Figure 1.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/199034/181214%20095536-Figure%201.jpeg)
9 comentarios
Adam Danz
el 17 de Dic. de 2018
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.
Más respuestas (1)
Image Analyst
el 14 de Dic. de 2018
Sounds like a Yair Altman question.
See his web site: Coloring cells in a uitable
0 comentarios
Ver también
Categorías
Más información sobre Data Distribution Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!