If I create a legend panel with a label which includes the new line escape character "\n"
, e.g.
leg = SwatchLegend[{Red, Green, Blue},
{"red", "green",
"long\nverbose\ncolour"},
LegendFunction -> (Framed[#, FrameStyle -> Thick] &),
LegendMargins -> 5]
All of the text is aligned to the left, however, when The object is included in another graphic using Epilog->Inset[..]
The alignment of the label containing "\n" is now raggedly centred.
tri = Graphics[{Thick,
Line[{{0, 0}, {100, 0}, {0.5*100, (Sqrt[3]/2)*100}, {0, 0}}]}];
Show[tri, Epilog -> Inset[leg, Scaled[{0.84, 0.74}]]]
Plot[2 Sin[x] - x, {x, 0, 6 Pi}, Frame -> True,
Epilog -> Inset[leg, Scaled[{0.8, 0.74}]]]
I've tried using Alignment->Left
to no avail. While the SwatchLegend
contains graphic elements it is not a Graphics
object. Clearly something changes when it is placed with Inset
.
Any suggestions on why this is happening? Is there a better way to convert it to a graphic before embedding it in Epilog
?