# Make two plots on top of each other

I would like to make a single plot which contains two graphs on top of each other like the plot below (with frames, axes labels and the legend on the top right corner)

I read this question and tried to implement it, but it did not work because it removes the labels of the axes when I use ImagePadding . Could somebody give me an example of how to do this?

Do you mean something like this?

p1 = Plot[Sin[x], {x, 0, 2 Pi},
Frame -> True,
PlotLegends -> Placed[Framed[LineLegend[{Automatic}, {"Something"}]], ImageScaled[{.8, .9}]]];

p2 = Plot[Cos[x], {x, 0, 2 Pi},
Frame -> True,
PlotLegends -> Placed[Framed[LineLegend[{Automatic}, {"Something"}]], ImageScaled[{.8, .9}]]];

GraphicsColumn[{p1, p2}]


• Almost there! How do I modify the spacing between the two plots? I ran the code but the spacing between them is too large. I want them a bit closer to each other. – eemg Oct 13 '20 at 1:15
• @eemg Add the Spacings -> Scaled[0] option to GraphicsGrid. Use a negative value rather than 0 to further decrease, but that might cause overlaps. – Rohit Namjoshi Oct 13 '20 at 1:23
• There is also: GraphicsGrid[{{p1}, {p2}}] – Daniel Huber Oct 13 '20 at 10:30
• You can also use ResourceFunction$“PlotGrid”$ which would do exactly what you want here! – CA Trevillian Oct 13 '20 at 20:21