# Plot not aligned after adding plot legends

The new GraphicsColumn function claims to have the ability to align the axes Align Frame Edges. It works fine for very very simple plots, but if one adds a simple thing such as plot legends to it, it will not work anymore. For example, a simple plot as below works:

 plot1 = ListLinePlot[{Range, Range[11, 20]},
Axes -> False,
Frame -> True];
plot2 = ListLinePlot[{Range[41, 50], Range[61, 115]},
PlotStyle -> {Red, Black},
Axes -> False,
Frame -> True];
plots = {plot1, plot2};
GraphicsColumn[plots]


But once we added legends, things start to break down:

plot1 = ListLinePlot[{Range, Range[11, 20]},
PlotLegends -> {"line 1", "line 2"},
Axes -> False,
Frame -> True];
plot2 = ListLinePlot[{Range[41, 50], Range[61, 115]},
PlotStyle -> {Red, Black},
PlotLegends -> {"line 3", "line 4"},
Axes -> False,
Frame -> True];
plots = {plot1, plot2};
GraphicsColumn[plots]


Mathematica really need to do something to catch up with Python in terms of visualization capabilities.

• Do you have a question or is this just a rant? – m_goldberg Apr 20 '19 at 1:14
• Plots can easily be aligned by giving both plots the same image padding such as ImagePadding -> {{30, 5}, {30, 5}}. I realize how frustrating it can be when things don't work the way you expect when you're new to a language, but this community is pretty good at helping if you give them a chance, either by asking a well-posed question or looking through answers to old questions. Vertically aligning two separate plots – MassDefect Apr 20 '19 at 1:54
• Try Spacings -> -100. – David G. Stork Apr 20 '19 at 2:11
• ImagePadding works well. Thanks @MassDefect. – baker Apr 20 '19 at 14:29

I always use Multicolumn for alignment. Using the same ImagePadding for all figures is crucial.

imgPad = {{20, 2}, {20, 6}};
plot1 = ListLinePlot[{Range, Range[11, 20]},
Axes -> False, Frame -> True];
plot2 = ListLinePlot[{Range[41, 50], Range[61, 115]},
PlotLegends -> {"line 3", "line 4"}, Axes -> False, Frame -> True];
Multicolumn[{plot1, plot2}, 1] Try with the following within the GraphicsColumn: Spacings->-80 • This doesn't appear to align the edges of the frames. It's close on the right side, but a bit off on the left side. – MassDefect Apr 20 '19 at 3:19
• I think the choice by @MassDefect using the "image padding" is the best. I will try to structure the post more like a question not a rant in the future. – baker Apr 20 '19 at 14:26

GraphicsColumn together with GraphicsRow and GraphicsGrid are a bit problematic tools. There is problem with determination of AspectRatio for resulting graphics. Moreover, the plot with legend is a combined object and therefore the aspect ration is another than for pure plots.

You should define the AspectRatio directly in both plots to obtain normal view.

plot1 = ListLinePlot[{Range, Range[11, 20]},
PlotLegends -> {"line 1", "line 2"}, Axes -> False, Frame -> True,
AspectRatio -> 0.6, ImageSize -> 400];
plot2 = ListLinePlot[{Range[41, 50], Range[61, 115]},
PlotStyle -> {Red, Black}, PlotLegends -> {"line 3", "line 4"},
Axes -> False, Frame -> True, AspectRatio -> 0.6, ImageSize -> 400];
plots = {plot1, plot2};
GraphicsColumn[plots, ImageSize -> 500, AspectRatio -> 0.6] 