MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Creating a Grid with square cells

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112643] Creating a Grid with square cells
  • From: Anthony Hodsdon <ajhodsd at yahoo.com>
  • Date: Fri, 24 Sep 2010 04:10:16 -0400 (EDT)

In the Mathematica documentation, I see that the parameters to ItemSize are
in rather unusual units:

In Grid, w is measured in ems, and h in line heights.

I'm attempting to create a Grid (not a GraphicsGrid) with square cells, but I am a bit at a loss. Is there a good conversion between ems and line heights? It seems to be about 3:2, but I suspect it's dependent upon the font in use. As a 
work-around, I also tried using ItemSize->{Scaled[x],Scaled[x]} (for some 
suitable x), which seemed to work, except that then the grid grew to fill the 
entire notebook width. I also tried sticking the grid inside a pane, but then 
the right side of the grid seems to get chopped off:

Pane[Grid[Table[i+j, {i,0,4}, {j,0,4}],Frame->All, 
Background->{3->LightBlue},ItemStyle->24, 

ItemSize->{Scaled[.2],Scaled[.2]}, Alignment->{Center, Center}], 
ImageSize->{200,200}]

Are there any good idioms for getting this to work?

Thanks,

--Anthony      


  • Prev by Date: Re: ContourPlot under ListPlot3D
  • Next by Date: Re: Calendar Recipe?
  • Previous by thread: Wanted - Mathematica demonstration showing mi/min to km/hr conversion
  • Next by thread: Re: Creating a Grid with square cells