Adding a legend to a MatrixPlot

I have produced this MatrixPlot:

Rows refer to countries and columns to ranks. Row 1 refers to Norway with many 1 ranks, row 15 to Greece with many 15 ranks. Other countries are inbetween.

I would like to add a “Legend” to this plot, i.e. the string “Norway” should align (on the right side) with the first row etc.

I have no idea how to accomplish this and any help would be appreciated.

=================

  

 

So you basically want Ticks with names instead of numbers?
– Öskå
May 22 ’14 at 11:59

  

 

Exactly! Left numbers, bottom numbers, right countries
– eldo
May 22 ’14 at 12:01

=================

1 Answer
1

=================

Specifying FrameTicks adds a “legend” to MatrixPlot’s row:

legend = {“Hello”, “How are you?”, “Good Bye”};
MatrixPlot[{{1, 2, 1}, {3, 0, 1}, {0, 0, -1}},
FrameTicks -> {
{True (* Left *),
Thread[{Range@Length@legend, legend}](* Right *)},
{True (* Bottom *), False (* Top *)}}]

  

 

Thanks, beautiful and exactly what I wanted 🙂
– eldo
May 22 ’14 at 12:06

  

 

I’m glad I could help 🙂
– Öskå
May 22 ’14 at 12:10