How to add legends with 6 or more discrete entries?

  • Mathematica
  • Thread starter Van Ladmon
  • Start date
  • #1

Main Question or Discussion Point

I want to add legends in ArrayPlot and my code is like this:
Code:
Table[ArrayPlot[
  FiniteGroupData[{"CyclicGroup", i}, "MultiplicationTable"],
  PlotLegends -> Range[i],
  ColorRules -> {x_ -> ColorData["Rainbow"][(x/i)]}],
{i, 1, 10}]
In the first 5 graphs this work well, but after the 6th graph these legends stick together like BarLegend and become somewhat strange. How can I deal with this problem?
 

Answers and Replies

  • #2
DrClaude
Mentor
7,344
3,541
Unless there is a maximum number of elements in a legend, and I couldn't find anything about that in the documentation, it looks like a bug.

If you try to use non-numerical labels, the legend simply disappears when you reach 6
Code:
ArrayPlot[FiniteGroupData[{"CyclicGroup", 6}, "MultiplicationTable"], 
PlotLegends -> {"a", "b", "c", "d", "e", "f"},
ColorRules -> {x_ -> ColorData["Rainbow"][(x/6)]}]
 
  • #3
Unless there is a maximum number of elements in a legend, and I couldn't find anything about that in the documentation, it looks like a bug.

If you try to use non-numerical labels, the legend simply disappears when you reach 6
Code:
ArrayPlot[FiniteGroupData[{"CyclicGroup", 6}, "MultiplicationTable"],
PlotLegends -> {"a", "b", "c", "d", "e", "f"},
ColorRules -> {x_ -> ColorData["Rainbow"][(x/6)]}]
It indeed looks like a bug but is there any relationship between PlotLegend and ChartLegends? ChartLegends work well in a chart when there's more than 5 of them.
 
  • #4
DrClaude
Mentor
7,344
3,541
It indeed looks like a bug but is there any relationship between PlotLegend and ChartLegends?
I have no idea. You should submit a bug report to Wolfram.
 

Related Threads on How to add legends with 6 or more discrete entries?

Replies
0
Views
1K
Replies
1
Views
4K
Replies
3
Views
5K
Replies
2
Views
5K
Replies
1
Views
2K
  • Last Post
Replies
9
Views
10K
  • Last Post
Replies
1
Views
3K
Replies
8
Views
714
Top