Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
Row[Table[Graphics[Rectangle[{0, 0}, {2^k, 1}]], {k, 0, 5}]]


enter image description here

However, I'd like uniform scaling of the rectangles, i.e., each rectangle should look twice the width (but same height) as its predecessor. How can I force "absolute sizing" here?

Second, how can I align the bottoms of the rectangles? I tried inserting Alignment->Bottom in several spots, none of which worked.

share|improve this question
I also find it strange that it is keeping the widths constant, but scaling the heights even though it is the widths that are increasing with k. – JohnD Nov 9 '12 at 19:42
up vote 7 down vote accepted

Row will resize anything that doesn't already have a size attribute set. By setting the imageheight for each graphics object but keeping the width Automatic, you get what you are looking for:

Row[Table[Graphics[Rectangle[{0, 0}, {2^k, 1}], ImageSize -> {Automatic, 25}, PlotRangePadding -> None], {k, 0, 5}]]

enter image description here

Since they are all the same height, they are all automatically aligned properly. If they weren't, I couldn't get Row to align them properly, but Grid did the trick easily.

Grid[{Table[Graphics[Rectangle[{0, 0}, {2^k, 1}],PlotRangePadding -> None], {k, 0, 5}]},  Alignment -> {Left, Bottom}]

gives this: enter image description here

share|improve this answer
My experience is that you can also control the spacing between elements a lot better with Grid than with Row. (Are we all agreed that GraphicsGrid is a trainwreck?) – user4368 Nov 9 '12 at 19:56
Yes, GraphicsGrid = trainwreck with maximal carnage, IMO. – JohnD Nov 9 '12 at 20:52
Jason, I still don't get why the first rectangle won't cooperate: Grid[{Table[Graphics[Rectangle[{0, 0}, {2^-k, 1}], PlotRangePadding -> None], {k, 0, 5}]}, Alignment -> {Left, Bottom}] – JohnD Nov 9 '12 at 20:55
@texasAUtiger, from what I can tell, Grid and Row will resize anything that doesn't have its ImageSize set already. So I would still set them so they all have the same height: Grid[{Table[Graphics[Rectangle[{0,0},{2^(-k),1}],PlotRangePadding->None,ImageSiz‌​e->{Automatic,25}],{k,0,5}]},Alignment->{Left,Bottom}] – user4368 Nov 9 '12 at 21:18
Jason, try e.g. Row[(*list*), Spacer[5]] – Mr.Wizard Nov 10 '12 at 9:12

You could specify the PlotRange explicitly as follows:

  Graphics[Rectangle[{0, 0}, {2^k, 1}], 
   PlotRange -> {{0, 2^5}, {0, 1}}], {k, 0, 5}]]


share|improve this answer
I'd need to avoid the large gaps of white space in this solution. – JohnD Nov 9 '12 at 19:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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