# How to get two or four figures in the same size?

I give an example for describing this problem.

f[x_] := Sin[x];
p1 = Plot[f[x], {x, 0, Pi}, Axes -> None, Frame -> True,FrameStyle -> Black,
FrameTicks -> {{{0, 0.5, 1}, None}, {{0, 1, 2, 3}, None}},
FrameStyle -> Directive[Black, Thickness[0.003]],
PlotRange -> {{0, 3}, {-0.1, 1}},FrameLabel -> {Style["x", FontSize -> 18],
Style["y", FontSize ->18]}, RotateLabel -> False]

g[x_] := Cos[x];
p2 = Plot[g[x], {x, 0, Pi}, Axes -> None, Frame -> True,FrameStyle -> Black,
FrameTicks -> {{{0, 0.5, 1}, None}, {{0, 1, 2, 3}, None}},
FrameStyle -> Directive[Black, Thickness[0.003]],
PlotRange -> {{0, 3}, {-0.1, 1}},
FrameLabel -> {Style["x", FontSize -> 18],
Style["\!$$\*SubscriptBox[\(log$$, $$100$$]\)y", FontSize -> 18]},
RotateLabel -> False]


These are two figures, p1 and p2. I try to use "GraphicsGrid", but I get it like:

p3 = GraphicsGrid[{{p1, p2}}, ImageSize -> 800, Spacings -> {5, 1},
Alignment -> Right, ItemAspectRatio -> 0.7]


How can I plot them in the same borderlayout? If there are four figures, how can I plot them in the style of two rows and two columns? Thanks.

Edit: I have one more question: If I want to get a two by two grid of plots, but the labels of the first two are FrameLabel -> {None,Style["y"]} , FrameLabel -> None. And the last two are FrameLabel -> {Style["x"],Style["y"]}, FrameLabel -> {Style["x"],None}. I only want to keep the same size in frames. My way is FrameLabel -> {Style["x",White],Style["y"]}, but the the red region is too wide, like

p5 = GraphicsGrid[{{p1, p2}, {p3, p4}}, Spacings -> {5, 0},
Alignment ->Right, ItemAspectRatio -> 0.7]

f[x_] := Sin[x];
p1 = Plot[f[x], {x, 0, Pi}, Axes -> None, Frame -> True,FrameStyle -> Black,
FrameTicks -> {{{0, 0.5, 1}, None}, {{0, 1, 2, 3}, None}},
FrameStyle -> Directive[Black, Thickness[0.003]],
PlotRange -> {{0, 3}, {-0.1, 1}},
FrameLabel -> {Style["x", FontSize -> 18, White],
Style["y", FontSize -> 18]}, RotateLabel -> False,
ImageSize -> {Automatic,200}]

g[x_] := Cos[x];
p2 = Plot[g[x], {x, 0, Pi}, Axes -> None, Frame -> True,FrameStyle -> Black,
FrameTicks -> {{{0, 0.5, 1}, None}, {{0, 1, 2, 3}, None}},
FrameStyle -> Directive[Black, Thickness[0.003]],
PlotRange -> {{0, 3}, {-0.1, 1}},
FrameLabel -> {Style["x", FontSize -> 18, White],
Style["\!$$\*SubscriptBox[\(log$$, $$100$$]\)y", FontSize -> 18]},
RotateLabel -> False, ImageSize -> {Automatic, 200}]

m[x_] := Cot[x];
p3 = Plot[m[x], {x, 0, Pi}, Axes -> None, Frame -> True,FrameStyle -> Black,
FrameTicks -> {{{0, 0.5, 1}, None}, {{0, 1, 2, 3}, None}},
FrameStyle -> Directive[Black, Thickness[0.003]],
PlotRange -> {{0, 3}, {-0.1, 1}},
FrameLabel -> {Style["x", FontSize -> 18],
Style["\!$$\*SubscriptBox[\(log$$, $$100$$]\)y", FontSize -> 18]},
RotateLabel -> False, ImageSize -> {Automatic, 200}]

n[x_] := Tan[x];
p4 = Plot[n[x], {x, 0, Pi}, Axes -> None, Frame -> True,FrameStyle -> Black,
FrameTicks -> {{{0, 0.5, 1}, None}, {{0, 1, 2, 3}, None}},
FrameStyle -> Directive[Black, Thickness[0.003]],
PlotRange -> {{0, 3}, {-0.1, 1}},
FrameLabel -> {Style["x", FontSize -> 18],
Style["y", FontSize -> 18]}, RotateLabel -> False,
ImageSize -> {Automatic, 200}]


Another one is like

p6 = GraphicsGrid[{{p1, p2}, {p3, p4}},Spacings -> {0, 0},
Alignment -> Right, ItemAspectRatio -> 0.7]

• Graphics + hit F1 -> Options -> ImageSize/ImagePadding/ImageMarings.
– Kuba
Aug 10, 2017 at 11:00

It is the interaction of a number of things that's causing the size difference. But one simple solution is just to remove ItemAspectRatio -> 0.7'. Then

p3 = GraphicsGrid[{{p1, p2}}, ImageSize -> 800, Spacings -> {5, 1}, Alignment -> Right]


gives

Another way of looking at what's happening is that your original figures p1 and p2 are being drawn the same width. But to make the log_100 y axis label in p2 fit into that width, the rest of the plot is shrunk. So another way to deal with it is to force both of the original images to be drawn to the same height by adding

ImageSize -> {Automatic, 250}


to the options for p1 and p2. You can then include ItemAspectRatio -> 0.7 in the options for p3 and the result is the same as the figure above.

Showing a two by two grid of plots is done simply by creating a "matrix" of plots and then using GraphicsGrid[{{p1, p2}, {p3, p4}}]' (as detailed in the documentation for`GraphicsGrid').

• Thank you for your help. Aug 10, 2017 at 12:07