Is there a better color scheme to make the lines and legends boxes more contranst?
I'm using ColorData[97]
but there are some colors that look similar so I'm looking for a better color scheme.
As you can see from the image below pairs 6, 16
, 1,7
, 9,14
look similar.
*colors = ColorData[97] /@ Range[24];
list = {{"a"}, {"b", "c"}, {"d"}, {"e"}, {"f"}, {"g"}, {"h",
"k"}, {"l"}, {"m"}, {"n"}, {"p", "q",
"k"}, {"x"}, {"y"}, {"z"}, {"kh"}, {"xy"}, {"cy"}, {"cz"}};
linelegend =
LineLegend[{Opacity[opacity, Gray],
Directive[Red, Thickness[0.01], Dashed], White},
Style[#, 30, Bold, Black] & /@ {"mnk", "htk", "kn"},
"LegendItem" -> {"Square", Automatic, "Square"},
LegendMarkerSize -> 25];
opacity = 0.2;
Dynamic[Legended[
Row[{Plot[{x^2 - 1, 2 x - 3, 5 - 3 x, 5 x - 2 x^2, x^2/3, x^2/3 - 2,
x^2/3 - 6, 2 x^2 - 1, 2 /3 x - 3, 1 - 3 x, 5/4 x - 2 , x^2 - 9,
5 x^2/3, 8 x^2/3 - 2, 9 x^2/3 - 6, 1/(2 x), 1/(x - 1), x^2/(
x - 3), 5 - 1/(3 x + 1), x^3/(6 x^2 + 3), x^5/(6 x - 3), 1/(
x^2 + 9), 1/(8 - x), 1/(1 - 5 x)}, {x, 0, 6},
GridLines -> Automatic,
PlotStyle ->
ReplacePart[
Directive[#, Thickness[0.005]] & /@
colors, {Except[Alternatives @@ n]} ->
Directive[Opacity[.01], Gray]], Ticks -> Automatic,
Frame -> True, Axes -> True, PlotStyle -> Thickness[0.5],
PlotRange -> {{0, 6}, {0, 6}},
FrameStyle -> Directive[Black, Bold, 20], GridLines -> Automatic,
GridLinesStyle -> LightGray, Ticks -> Automatic,
TicksStyle -> Directive[Black, Bold, 20], ImageSize -> 800],
Spacer[10], linelegend}],
Placed[{Spacer@{0, 20},
TogglerBar[Dynamic[n],
MapIndexed[#2[[1]] ->
ToString[
Framed[Style[#2[[1]], Black, Bold, 15],
ImageSize -> {45, 45}, Alignment -> Center,
Background -> colors[[#2[[1]]]]], StandardForm] <>
ToString[
Framed[Style[#, Black, Bold, 15], ImageSize -> {230, 45},
Alignment -> Center, Background -> White],
StandardForm] &, list],
Appearance -> "Vertical" -> {Automatic, 3}]} // Column, {Left,
Below}]]]*
colors=Table[Hue[i, 0.5, 1.0], {i, 1/18, 1, 1/18}]
. Which provide will evenly spaced hues. Playing around with the second argument for saturation, 0.5 seems to give the most easily distinguishable colors. But you still end up with some pink/purples that look close to me. You could also choose only 9 hues and add two steps in value, or saturation to make it a little easier to tell the difference. I also agree that color isn't the way to go here though. $\endgroup$