2
$\begingroup$

I was trying to use Grid to align different plots, two on the first row, and only one in the second row, so I have something like this (where a,b and c are plots): Grid[{{a, b},{c}}].

The problem is, I would like for the 'c' plot to be aligned directly below the union of 'a' and 'b', and not the default placement right below 'a' leaving nothing below 'b'. How could I do this? I can't seem to find an option for it or another question like mine.

$\endgroup$
3
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Aug 17, 2015 at 3:43
  • 3
    $\begingroup$ Try Grid[{{a, b}, {c, SpanFromLeft}}]. Here is the documentation for SpanFromLeft. $\endgroup$
    – MarcoB
    Aug 17, 2015 at 3:52
  • $\begingroup$ Thank you MarcoB!! Such a simple thing! $\endgroup$
    – Diego
    Aug 17, 2015 at 4:05

1 Answer 1

3
$\begingroup$

There are a number of ways to do that, or something like that. These are the plots and your Grid function:

a = Plot[Sin[x], {x, 0, 2 \[Pi]}, ImageSize -> 200];
b = Plot[Sin[2 x], {x, 0, 2 \[Pi]}, ImageSize -> 200];
c = Plot[Sin[3 x], {x, 0, 2 \[Pi]}, ImageSize -> 200];
Grid[{{a, b}, {c}}]

It yields the following:

enter image description here

This places the plot c in the middle below a and b:

Column[{Row[{a, b}], c}, Alignment -> Center]

returning the following:

enter image description here

This also returns c in the middle, but there is some extra space between a and b:

Grid[{{a, b}, {Row[{Spacer[300], c}]}}]

enter image description here You can play with the spacing to adjust the position.

And finally, the excellent advice of MarcoB given as a comment.

Have fun!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.