# Would like to draw something similar to confusionMatrix created by ClassifierMeasurements

How do I show the values in each box? I know how to add the labels.

MatrixPlot[{{14789, 482}, {446, 202}},
Epilog -> {
Text[14789, {1/2, 3/2}],
Text[  482, {3/2, 3/2}],
Text[  446, {1/2, 1/2}],
Text[  202, {3/2, 1/2}]}]


This generalizes (for quadratic matrices) to

m = {{14789, 482, 100}, {446, 202, 200}, {1, 2, 3}};

t =
Transpose@Map[Flatten, {#, Reverse@Transpose@#} &
[Table[Range[1, 2 # - 1, 2], {#}]] &[Length@m]]/2


MatrixPlot[m, Epilog -> Text @@@ Transpose[{Catenate@m, t}]]


m = {{14789, 482}, {446, 202}};

t =
Transpose@Map[Flatten, {#, Reverse@Transpose@#} &
[Table[Range[1, 2 # - 1, 2], {#}]] &[Length@m]]/2;

p =
MatrixPlot[m,
Epilog -> Text @@@ Transpose[{Catenate@m, t}],
FrameTicks -> {
{{1, "Left1"}, {2, "Left2"}},
{{1, "Bottom1"}, {2, "Bottom2"}},
{{1, "Right1"}, {2, "Right2"}},
{{1, "Top1"}, {2, "Top2"}}},
ImageSize -> Medium];

Column[{
Row[{Rotate["actual class", 90 Degree], Spacer@15, p}],
Spacer@5, "predicted class"}, Alignment -> Center]


• Good start, but what about the frame labels? – m_goldberg Jan 10 '16 at 5:36
• "I know how to add the labels" - from the question – eldo Jan 10 '16 at 11:54