0
votes

I have a huge matrix. I'm talking 4^7x4^7. Each grid cell has a probability distribution associated with it. I would like to visualize this matrix by assigning a color to it based on the highest probability and a shade based on the magnitude of the probability. For example:

__                                         __
|(.8,.1,.1) (.6,.3,.1) (.4,.4,.2) (.2,.6,.2)|
|(.1,.6,.3) (.1,.2,.7) (.2,.3,.5) (.1,.4,.5)|
|(.4,.1,.5) (.3,.1,.6) (.6,.2,.2) (.7,.1,.2)|
|(.2,.5,.3) (.8,.1,.1) (.4,.3,.3) (.2,.6,.2)|
__                                         __

I would want cells (1,1), (1,2), (3,3), (3,4), (4,2), (4,3) to be red, with cell (1,1) being a darker shade than (4,3) Also, I would want (1,4), (2,1), (4,1), (4,4) to be blue, with (1,4) being darker than (4,1) And so on and so forth.

My actual implementation will need 8 separate colors. I was planning on doing this in Matlab, but if it would be easier in Excel I can use that.

Any ideas? Is this too crazy?

Thanks in advance!

2

2 Answers

1
votes

I assume your probability matrix P is of size m-by-n-by-k with k the number of classes/colors you have.
In that case you can do:

>> colors = rand( k, 3 ); % pick k differet colors
>> [shade idx] = max( P, [], 3 ); % choose class per pixel
>> output = ind2rgb( idx, colors ); % convert class to colors
>> output = bsxfun( @times, output, shade ); % apply the shade
>> figure; imshow( output ); 
0
votes

Colors and matrix, that sounds like heat map. Here's an example built in d3js:

http://vida.io/documents/6NHboDKAAei9r5j2S

Looks like you can also do heat map in Matlab.

http://www.mathworks.com/matlabcentral/fileexchange/24253-customizable-heat-maps/content/html/heatmap_examples.html