How to add legends with 6 or more discrete entries?

  • Context: Mathematica 
  • Thread starter Thread starter Van Ladmon
  • Start date Start date
  • Tags Tags
    Discrete
Click For Summary

Discussion Overview

The discussion revolves around the issue of adding legends in ArrayPlot when there are 6 or more discrete entries. Participants explore the behavior of legends in relation to the number of entries and question whether there is a limitation or bug affecting the display of legends.

Discussion Character

  • Technical explanation, Debate/contested

Main Points Raised

  • One participant describes their attempt to add legends in ArrayPlot, noting that the legends work correctly for the first 5 graphs but become problematic for the 6th graph and beyond.
  • Another participant suggests that there may be a maximum number of elements allowed in a legend, which they could not find documented, and proposes that the issue might be a bug.
  • A similar point is reiterated by another participant, who notes that using non-numerical labels causes the legend to disappear when reaching 6 entries, further supporting the idea of a bug.
  • There is a question raised about the relationship between PlotLegend and ChartLegends, with one participant observing that ChartLegends function correctly even with more than 5 entries.
  • Another participant suggests submitting a bug report to Wolfram regarding the issue.

Areas of Agreement / Disagreement

Participants express uncertainty about whether there is a maximum number of elements in a legend and whether the observed behavior is a bug. There is no consensus on the relationship between PlotLegend and ChartLegends.

Contextual Notes

The discussion highlights potential limitations in the documentation regarding legend entries and the specific behavior of legends in ArrayPlot versus ChartLegends.

Van Ladmon
Messages
8
Reaction score
0
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?
 
Physics news on Phys.org
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)]}]
 
DrClaude said:
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.
 
Van Ladmon said:
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.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K