Grid
- To: mathgroup at smc.vnet.net
- Subject: [mg76576] Grid
- From: Fred Simons <f.h.simons at tue.nl>
- Date: Thu, 24 May 2007 06:04:16 -0400 (EDT)
No doubt one of the big improvements in Mathematica 6 is the function Grid. I used it already many times with excellent result. Nevertheless, there are two 'features' that strongly surprise me. How to use options in Grid is well documentated. With the option Spacings it is very easy to obtain that no spacing will be used at the edge of the grid, i.e. before the first and behind the last column, above the first row and below the last row, so I cannot find any reason for the following behaviour. For a nice application I needed a spacing at the edge of the grid and I discovered that spacing at the edge is impossible if there is not a line placed by the option Dividers or by the option Frame. Otherwise stated: the effect of the option Spacings depends on the setting of the options Dividers or Frame. A very unpleasant situation, not in line with the high standards of Mathematica. Here is an example, where the option Spacings is used before the first column, between the first and second column and behind the last column, and similarly for the rows. mat = Array[ Style[RandomChoice[{"a", "aa", "aaa"}] , Background -> GrayLevel[0.8], FontSize -> 20] &, {4, 4}]; Manipulate[ Grid[mat, Dividers -> div, Spacings -> {{sp1, sp1, {0}, sp1}, {sp2, sp2, {0}, sp2}}, Background -> Yellow], {{sp1, 2, "Column spacing"}, 0, 10}, {{sp2, 2, "Row spacing"}, 0, 10}, {{div, All, "Dividers"}, {None, Center, All, {-1 -> True}}} ] A much less important observation is that the option Frame does not have any effect when the option Dividers is in the Grid command, even if the right-hand side of the option Dividers is the default value. So Dividers and Frame cannot be used at the same time. Here is the example to play with: Manipulate[ Grid[mat, Spacings -> {3, 3}, Frame -> fr, Background -> Yellow, If[divopt, Options[Grid, Dividers][[1]], Sequence @@ {}] ], {{fr, None, "Frame"}, {None, {2 -> True}, {{2 -> True}, {1 -> True}}, {None, None, {1, 2} -> True}}}, {{divopt, False, "Option Dividers "}, {True, False}} ] Fred Simons Eindhoven University of Technology
- Follow-Ups:
- Re: Grid
- From: "Lev Bishop" <lev.bishop@gmail.com>
- Re: Grid