# Uniform scaling of a Table of Graphics objects?

Row[Table[Graphics[Rectangle[{0, 0}, {2^k, 1}]], {k, 0, 5}]]


yields

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.

• 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. Nov 9 '12 at 19:42

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}]]


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:

• 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. 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}] 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,ImageSize->{Automatic,25}],{k,0,5}]},Alignment->{Left,Bottom}]
– user4368
Nov 9 '12 at 21:18
• Jason, try e.g. Row[(*list*), Spacer[5]] Nov 10 '12 at 9:12

You could specify the PlotRange explicitly as follows:

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


• I'd need to avoid the large gaps of white space in this solution. Nov 9 '12 at 19:43