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
SUMMARY

The discussion focuses on the issue of adding legends in ArrayPlot when using the Wolfram Language, specifically with the FiniteGroupData function. Users report that legends work correctly for up to 5 entries but become problematic when exceeding 6 entries, appearing to stick together or disappear entirely when using non-numerical labels. This behavior suggests a potential bug in the PlotLegends functionality, as ChartLegends do not exhibit the same limitations. Participants recommend submitting a bug report to Wolfram for further investigation.

PREREQUISITES
  • Familiarity with Wolfram Language syntax and functions
  • Understanding of ArrayPlot and its parameters
  • Knowledge of FiniteGroupData and its applications
  • Basic concepts of color mapping using ColorData
NEXT STEPS
  • Investigate the behavior of PlotLegends in Wolfram Language versions beyond the current one
  • Explore the differences between PlotLegends and ChartLegends in Wolfram Language
  • Learn how to submit bug reports to Wolfram for software issues
  • Examine alternative methods for creating legends in ArrayPlot with more than 6 entries
USEFUL FOR

Wolfram Language users, data visualizers, and developers working with ArrayPlot who need to manage legends effectively in their visualizations.

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