# Combine multiple swatch legends

How can I combine multiple SwatchLegends? As a minimal example:

Legended[
Show[g1 = Graphics3D[{Opacity[0.6], Red, Sphere[]}]],
SwatchLegend[{Red, Red, Red}, {"x\[Rule]ξ", "y\[Rule]η", "z≡ζ"}]]


Legended[
Show[g2 = Graphics3D[{Opacity[0.4], Blue, Cylinder[]}]],
SwatchLegend[{Blue, Blue, Blue}, {"ξ≡ξ'", "η\[Rule]η'", "ζ\[Rule]ζ'"}]]


Legended[
Show[g3 = Graphics3D[{Green, Cone[]}]],
SwatchLegend[{Green, Green, Green}, {"ξ'\[Rule]x'", "η'\[Rule]y'", "ζ'≡z'"}]]


Now I would like to combine them; something like

Legended[
Show[{g1, g2, g3}],
SwatchLegend[{
{Red, Red, Red}, {"x\[Rule]ξ", "y\[Rule]η", "z≡ζ"},
{Blue, Blue, Blue}, {"ξ≡ξ'", "η\[Rule]η'", "ζ\[Rule]ζ'"},
{Green, Green, Green}, {"ξ'\[Rule]x'", "η'\[Rule]y'", "ζ'≡z'"}}]]


does not work.

I failed to find a duplicate.

• I don't understand. Have you tried to follow the syntax of SwatchLegend? – Kuba Nov 25 '15 at 15:21
• @Kuba: Do you mean that it just suffices to see the documentation of SwatchLegend? – Dimitris Nov 25 '15 at 15:53
• I am voting to reopen this question because I think it a bad idea to close an up-voted question with five good answers just because it is possible for a highly experienced Mathematica user can work out a solution by reading the docs. – m_goldberg Nov 26 '15 at 1:04
• @m_goldberg sorry but I do not agree with your reopen reason. Could you elaborate why only highly experienced users are able to follow the syntax presented in usage section? I may have misssed something in this question, then Im sorry. But i really can't see a deeper bottom here. No I look like a bully ;) – Kuba Nov 26 '15 at 6:59
• P.s. but ofc I do not mind reopening, that's a part of this system – Kuba Nov 26 '15 at 7:03

To avoid redundant color swatches:

g1 = Graphics3D[{Opacity[0.6], Red, Sphere[]}];
g2 = Graphics3D[{Opacity[0.4], Blue, Cylinder[]}];
g3 = Graphics3D[{Green, Cone[]}];

Legended[Show[g1, g2, g3],
SwatchLegend[
{Red, Blue, Green},
{Column[{"", "x\[Rule]ξ", "y\[Rule]η",
"z≡ζ", ""}],
Column[{"", "ξ≡ξ'", "η\[Rule]η'",
"ζ\[Rule]ζ'", ""}],
Column[{"", "ξ'\[Rule]x'", "η'\[Rule]y'",
"ζ'≡z'", ""}]}]]


Show already combines these if you include the legends in your assignments.

x1 = Legended[Show[Graphics3D[{Opacity[0.6], Red, Sphere[]}]],
SwatchLegend[{Red, Red, Red}, {"x\[Rule]ξ", "y\[Rule]η", "z≡ζ"}]];

x2 = Legended[Show[Graphics3D[{Opacity[0.4], Blue, Cylinder[]}]],
SwatchLegend[{Blue, Blue, Blue}, {"ξ≡ξ'", "η\[Rule]η'", "ζ\[Rule]ζ'"}]];

x3 = Legended[Show[Graphics3D[{Green, Cone[]}]],
SwatchLegend[{Green, Green, Green}, {"ξ'\[Rule]x'", "η'\[Rule]y'", "ζ'≡z'"}]];


Now simply:

Show[x1, x2, x3]


• Nice and easy! Thanks! – Dimitris Nov 25 '15 at 18:03

you can also do it like this:

Legended[Show[{g1, g2, g3}],
Grid[{SwatchLegend @@@ {{{Red, Red, Red}, {"x\[Rule]ξ", "y\[Rule]η", "z≡ζ"}},
{{Blue, Blue, Blue}, {"ξ≡ξ'", "η\[Rule]η'", "ζ\[Rule]ζ'"}},
{{Green, Green, Green}, {"ξ'\[Rule]x'", "η'\[Rule]y'", "ζ'≡z'"}}}}]]


• Thanks a lot! I was sure I would get many answers:-)! – Dimitris Nov 25 '15 at 18:04
Legended[Show[{g1, g2, g3}],
SwatchLegend[{RGBColor[1, 0, 0], RGBColor[0, 0, 1], RGBColor[0, 1, 0], RGBColor[1, 0, 0],
RGBColor[0, 0, 1], RGBColor[0, 1, 0], RGBColor[1, 0, 0], RGBColor[0, 0, 1],
RGBColor[0, 1, 0]},
{"x\[Rule]ξ", "ξ≡ξ'", "ξ'\[Rule]x'", "y\[Rule]η", "η\[Rule]η'",  "η'\[Rule]y'", "z≡ζ",
"ζ\[Rule]ζ'", "ζ'≡z'"},
LegendLayout -> {"Row", 3}]]


Or

Legended[Show[{g1, g2, g3}],
SwatchLegend[{RGBColor[1, 0, 0], RGBColor[0, 0, 1], RGBColor[0, 1, 0], RGBColor[1, 0, 0],
RGBColor[0, 0, 1], RGBColor[0, 1, 0], RGBColor[1, 0, 0], RGBColor[0, 0, 1],
RGBColor[0, 1, 0]},
{"x\[Rule]ξ", "ξ≡ξ'", "ξ'\[Rule]x'", "y\[Rule]η", "η\[Rule]η'", "η'\[Rule]y'",
"z≡ζ", "ζ\[Rule]ζ'", "ζ'≡z'"},
LegendLayout -> {"Column", 3}]]


• Thanks a lot! All the answers I received are great! – Dimitris Nov 25 '15 at 18:05