Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Creating a Grid with square cells

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112658] Re: Creating a Grid with square cells
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Sat, 25 Sep 2010 02:19:41 -0400 (EDT)
  • References: <i7hmdv$htn$1@smc.vnet.net>

Something like this?

Pane[Grid[Table[i + j, {i, 0, 4}, {j, 0, 4}], Frame -> All,
  Background -> {3 -> LightBlue}, ItemStyle -> 24,
  Alignment -> {Center, Center}], ImageSize -> 300,
 ImageSizeAction -> "ResizeToFit"]

Cheers -- Sjoerd

On Sep 24, 10:10 am, Anthony Hodsdon <ajho... at yahoo.com> wrote:
> 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: Convex crossover in genetic algorithm
  • Next by Date: UnitStep vs Piecewise
  • Previous by thread: Creating a Grid with square cells
  • Next by thread: Re: Creating a Grid with square cells