Where is all the vertical whitespace coming from, and how do I get rid of it?
plot = Plot[{Sin[x], Cos[x]}, {x, 0, 10}, Frame -> True,
PlotLegends -> Placed[LineLegend["Expressions"], {1, 0.5}]];
GraphicsGrid[{{plot, plot}, {plot, plot}}, Spacings -> {0, 0}]
EDIT
Okay, AspectRatio
is definitely the key for the GraphicsGrid
option (which I'm pursuing in case I don't want to rasterize). It seems I get rid of all whitespace if:
- Use
AspectRatio->Full
in both the plot and theGraphicsGrid
- Use numerical placement of the legends...not tags like "Before", etc.
What I've come up with so far would get with hairy frame labels, or tick/legend text that varied in length, but I think those things are beyond the scope of this post:
leftPlot =
Plot[{Sin[x], Cos[x]}, {x, 0, 10}, Frame -> True, FrameTicks -> All,
AspectRatio -> Full, Background -> Green,
PlotRange -> {{-0.5, 10.5}, {-1.1, 1.1}},
PlotLegends ->
Placed[LineLegend["Expressions"], {{0, 0.5}, {1, 0.5}}]];
rightPlot =
Plot[{Sin[x], Cos[x]}, {x, 0, 10}, Frame -> True, FrameTicks -> All,
AspectRatio -> Full, Background -> Green,
PlotRange -> {{-0.5, 10.5}, {-1.1, 1.1}},
PlotLegends ->
Placed[LineLegend["Expressions"], {{1, 0.5}, {0, 0.5}}]];
GraphicsGrid[
{{
Show[leftPlot,
ImagePadding -> {{Automatic, None}, {None, Automatic}}],
Show[rightPlot,
ImagePadding -> {{None, Automatic}, {None, Automatic}}]
},
{
Show[leftPlot,
ImagePadding -> {{Automatic, None}, {Automatic, None}}],
Show[rightPlot,
ImagePadding -> {{None, Automatic}, {Automatic, None}}]
}},
Spacings -> {0, 0}, Frame -> True, AspectRatio -> Full,
ImageSize -> 72*{8, 4}]
AspectRatio
parameter inside yourPlot
function. For exampleAspectRatio -> 1
. Maybe move your legend down. $\endgroup$Grid
instead ofGraphicsGrid
. $\endgroup$