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

MathGroup Archive 2008

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

Search the Archive

Re: Re: partial Dividers?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93098] Re: [mg93043] Re: partial Dividers?
  • From: "Thomas Dowling" <thomasgdowling at gmail.com>
  • Date: Sun, 26 Oct 2008 01:28:19 -0500 (EST)
  • References: <gdmsd3$ll$1@smc.vnet.net> <200810240632.CAA23190@smc.vnet.net>

Hello,

I like the Grid of Grids solutions proposed by Bob Hanlon and David Park,
which I did not know about.

Another more awkward way of achieving the same effect, but which (seemingly)
avoids the
'background' problem outlined by David Park, is it create a separate
headings list and to
use Item and Frame to suppress the unwanted lines.

For Example (modifying the example of David P):

headings = {{Item["a", Frame -> { True, True, True, False}],
    Item["b", Frame -> { True, False, True, True}],
    Item["c", Frame -> { True, False, True, True}],
    Item["d", Frame -> { True, False, True, True}],
    Item["e", Frame -> { True, False, True, True}]}};

table = Table[i + j, {i, 1, 5}, {j, 1, 5}];

The grid may now be generated from the following:

Grid[Join[headings, table], Frame -> True, FrameStyle -> Orange,
 Dividers -> {All -> True, {None}},
 Background -> {None, {1 -> GrayLevel[.8]}}, ItemSize -> {2, 1.5}]

Or using your own example:

m = Partition[Range[15], 3];
m[[1, 1]] = Item[1, Frame -> { True, True, True, False}];
m[[1, 2]] = Item[10^6, Frame -> { True, False, True, False}];
m[[1, 3]] = Item[10^6, Frame -> { True, False, True, True}];

And:

Grid[m, Frame -> True, FrameStyle -> Orange,
 Dividers -> {All -> True, {None}},
 Background -> {None, {1 -> GrayLevel[.8]}}]


I use this approach as it does what I want, and I too like the completely
filled background,
but there must be a 'neater' way?


Tom Dowling.





On Fri, Oct 24, 2008 at 7:32 AM, Mark Fisher <particlefilter at gmail.com>wrote:

> On Oct 22, 5:39 am, Bob Hanlon <hanl... at cox.net> wrote:
> > m = Partition[Range[9], 3];
> >
> > Grid[{
> >   {Grid[{First[m]}]},
> >   {Grid[Rest[m], Dividers -> {{False, True}, False}]}}]
> >
> > Bob Hanlon
> >
> > ---- Mark Fisher <particlefil... at gmail.com> wrote:
> >
> > =============
> > 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
> >
> > --
> >
> > Bob Hanlon
>
> Being inspired by the suggestions of both Bob and David, I have come
> up with the following, which does pretty much what I want (I think),
> but it's not fully automatic in the sense that one needs to know the
> proper width for the first column (which appears as the first
> numerical value in the specification for "size").
>
> m = Partition[Range[15], 3];
> m[[1, 2]] = 10^5;
> m[[1, 3]] = 10^5;
>
> With[{size = {{1, {Automatic}}, {1}}, align = Right},
>  Grid[{{
>    Grid[{Most[First[m]]}, ItemSize -> size, Alignment -> align],
>    SpanFromLeft,
>    Last[First[m]]
>    },
>   Sequence @@ Rest[m]},
>  Dividers -> {{True, True, {False}, True}, {True, True, {False},
>     True}}, ItemSize -> size, Alignment -> align]
>  ]
>
> Thanks guys. Of course, any further suggestions will be appreciated.
>
> --Mark
>
>



  • Prev by Date: Re: Looking for Stop
  • Next by Date: nested derivatives
  • Previous by thread: Re: partial Dividers?
  • Next by thread: BinaryReadList with Mixed Types