I've been attempting to find efficient ways to generate graphics with legends for export, and have been working with both LevelScheme
and the new (to v9) PlotLegends
. It seems the easiest approach would be to use PlotLegends
to automatically generate the legends with the graphic, peel out the plots and legends separately, then use LevelScheme
to arrange/combine as desired. Sounds pretty painless, but...
The RawGraphics
command of LevelScheme
does not accept MMA's LineLegend
, etc. objects. The only workaround I've found is to wrap the legend in Graphics[Inset[...]]
, but this breaks down, as LevelScheme
dumps these graphics objects in the middle of the MultiPanel
area.
Any ideas on how to get this working (or maybe why it cannot work)? Below is my attempt so far:
Get["LevelScheme`"];
myPlot = Plot[Sin[x], {x, 0, 10}, ImageSize -> 72*3,
PlotLegends -> Placed[LineLegend["Expressions"], {After, Center}]];
Graphics[Inset[myPlot[[2, 1, 1]]], ImagePadding -> None,
PlotRangeClipping -> True]
myDensity =
DensityPlot[Sin[x], {x, 0, 10}, {y, -1, 1}, ImageSize -> 72*3,
PlotLegends -> Automatic];
Graphics[Inset[myDensity[[2, 1, 1]]], ImagePadding -> None,
PlotRangeClipping -> True]
Figure[
{
Multipanel[
{{0, 1}, {0, 1}},
{2, 2},
XPlotRanges -> {{0, 10}, {-1, 1}},
YPlotRanges -> {{-1.1, 1.1}, {-1.1, 1.1}}
],
FigurePanel[{1, 1}],
RawGraphics[myPlot[[1]]],
FigurePanel[{2, 1}],
RawGraphics[myDensity[[1]]],
FigurePanel[{1, 2}],
RawGraphics[
Graphics[Inset[myPlot[[2, 1, 1]]], ImagePadding -> None,
PlotRangeClipping -> True]],
FigurePanel[{2, 2}],
RawGraphics[
Graphics[Inset[myDensity[[2, 1, 1]]], ImagePadding -> None,
PlotRangeClipping -> True]],
},
PlotRange -> Automatic,
ExtendRange -> {{0.1, 0.1}, {0.15, 0.1}},
ImageSize -> 6*72, Frame -> True
]