Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to align my plots like I did with Gird[].

But you cracks here are using these short forms all the time. So, is there a way to achive this result in a better way?

Here 's my code:

plots = DateListPlot[CountryData[#, {"Population", {1800, 2020}}], 
     PlotLabel -> "population of " <> #,ImageSize->250] & /@ {"Poland", "Austria", 
    "Switzerland", "India"};

GraphicsGrid[{{plots[[1]], plots[[2]]}, {plots[[3]], plots[[4]]}}, 
 ImageSize -> 500]

With this I'll get

The result I get with <code>Grid[]</code>

But I want to do something like this


enter image description here

I don't like the column but I hope there's a way my code could look like this.

Thanks to Kuba's comment this part of my question is answered:

"And btw, is there a way to change the ImageSize here?"

share|improve this question

closed as off-topic by Kuba, m_goldberg, ciao, Oleksandr R., ubpdqn Apr 23 '14 at 9:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Kuba, m_goldberg, ciao, Oleksandr R., ubpdqn
If this question can be reworded to fit the rules in the help center, please edit the question.

Set the ImageSize and ImagePadding etc. when you create your plots at first. p.s. I'm not sure what is the question but maybe you need GraphicsGrid@Partition[plots,2]? –  Kuba Apr 23 '14 at 7:25
Basically you want to convert {1,2,3,4} to {{1,2},{3,4}} which can be done as above. I find it easy to find in documentation as a part of basic list operations –  Kuba Apr 23 '14 at 7:43

1 Answer 1

Hmm, perhaps you just want to define a "function"?

myLayout[plots_] := 
 GraphicsGrid[{{plots[[1]], plots[[2]]}, {plots[[3]], plots[[4]]}}, 
  ImageSize -> 500]

This can then be called with:

share|improve this answer
Basically, that's what I want to do. But I'm looking for something like this GraphicsGrid[{{#1,#2},{#3,#4}}]&plots. Due to the structure of plots GraphicsGrid@{plots}gives me the GraphicsRow[]... one step closer ;-) –  Phab Apr 23 '14 at 7:36
or GraphicsGrid[Partition[{##}, 2]] & @@ plots, GraphicsGrid[Partition[{##}, 1]] & @@ plots ... GraphicsGrid[Partition[{##}, 4]] & @@ plots etc...? –  kguler Apr 23 '14 at 7:40
@kguler Yes, that's the kind of code I'm looking for. .. now I just have to understand what's happening. –  Phab Apr 23 '14 at 7:43
Look up ## and @@ in the docs:) –  kguler Apr 23 '14 at 7:45

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