MathGroup Archive 2008

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

Search the Archive

Re: partial Dividers?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92973] Re: partial Dividers?
  • From: "David Park" <djmpark at comcast.net>
  • Date: Wed, 22 Oct 2008 05:35:10 -0400 (EDT)
  • References: <gdkakk$4ri$1@smc.vnet.net>

Although Grid is a great improvement over Version 5 GridBox or TableForm, in 
my opinion it is poorly designed.

With the present design, one way to do get your divider is to use a Grid of 
Grids. But this only works up to a point.

grid1 = Grid[{{"a", "b", "c", "d", "e"}},
  ItemSize -> {1, 1}]

grid2 = Grid[Table[i + j, {i, 1, 5}, {j, 1, 5}],
  ItemSize -> {1, 1},
  Dividers -> {{False, True}, False}]

Grid[{{grid1}, {grid2}},
 Dividers -> All]

Or you could use Frame -> All in the last statement. But there seems to be 
an interaction between Dividers and Frame such that if one uses Dividers, 
then Frame doesn't work as expected.

However, if you want to do something such as use a Background color on some 
of the sub Grids then there are problems because the color does not fill the 
space and the result does not look good.

grid1 = Grid[{{"a", "b", "c", "d", "e"}},
  ItemSize -> {1, 1}, Background -> GrayLevel[.8]]

Grid[{{grid1}, {grid2}},
 Dividers -> All]

It seems to me that a much better design for Grid would be one in which the 
user could start with an array, using the SpanFrom commands if necessary, 
and then specify which lines and backgrounds were wanted. It would be easier 
if there were an individual command for each item instead of the complicated 
present option specifications. There might be something like:

GridHorizontalLine[row, {columnstart, columnend}, styledirective:Black, 
endmargins:0]
GridVerticalLine[column, {rowstart, rowend} styledirective:Black, 
endmargins:0]
GridBackground[{minrow,mincolumn},{maxrow,maxcolumn},background, 
backgroundmargins:{0,0}]

Then one might write a Grid statement as:

Grid[gridarray,
 line and background commands...,
 options]

This would be more intuitive to the user and would give specific control. 
Usually there would be only a few lines in a Grid. Leave it to the user to 
use Map or MapThread or some construct to draw many lines if necessary. The 
present option constructs try to do too much, are a complicated pain in the 
neck, and are incomplete to boot.

-- 
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/


"Mark Fisher" <particlefilter at gmail.com> wrote in message 
news:gdkakk$4ri$1 at smc.vnet.net...
> Hi all,
>
> In a Grid, I'd like to have a divider between columns 1 and 2 (for
> example) that goes from the 2nd row to the last row. But I can't
> figure out a way to make a divider that doesn't span the entire grid.
> Is there a way?
>
> --Mark
> 



  • Prev by Date: Re: Is there a simple way to transform 1.1 to 11/10?
  • Next by Date: Re: Is there a simple way to transform 1.1 to 11/10?
  • Previous by thread: Re: partial Dividers?
  • Next by thread: Re: partial Dividers?