The answer about the pattern you are missing:
each value in an array is the value that generates color for Integer coordinates like (1,1) between those an interpolation is done by ListDensityPlot
.
Matrices world:
- First index refers to rows
- First row is the top one
Graphics world
- First coordinate refers to "columns"
- First "row" refers to the bottom one.
Panel@Grid[{
{MatrixForm@array,
Grid[MapIndexed[
Framed[#,
Background ->
Directive[[email protected], Blend["Rainbow", #2[[1]]/4]],
ImageSize -> 35 {1, 1}, Alignment -> Center,
BaseStyle -> {Bold, White}] &, array, {2}],
Spacings -> 1.5 {1, 1}]
,
ListDensityPlot[array,
BaseStyle -> 24, Mesh -> Full, MeshStyle -> White,
PlotRangePadding -> .5,
Epilog -> {MapIndexed[
Inset[Framed[#,
Background ->
Directive[Opacity[4/#], Blend["Rainbow", #2[[1]]/4]],
ImageSize -> 35 {1, 1}, Alignment -> Center,
BaseStyle -> {Bold, White}], #2] &, array, {2}]},
ImageSize -> 500, ImagePadding -> 45]
}}, Alignment -> Center, Spacings -> 3]