I have the following problem. I'd like to add a legend to MatrixPlot
. Each colour should have a legend entry. I used PlotLegends
, which in principle works. However, if I use more than five colours, this doesn't work anymore.
a = RandomInteger[{1, 6}, {50}];
MatrixPlot[{a}, ColorRules ->
{1 -> Red, 2 -> Blue, 3 -> Green, 4 -> Gray,5->Yellow,6->Orange}]