5

I want to display a table like this:

enter image description here

And use Divider I can only get this so far

t=Table[x, {10}, {10}];    
Grid[t, 
     Dividers -> {{{{True, False}}, {-1 -> False, 
         1 -> False}}, {{{True, False}}, {-1 -> False, 1 -> False}}}]

enter image description here

How can I remove the extra part of the divider?

cormullion
  • 24,243
  • 4
  • 64
  • 133
xslittlegrass
  • 27,549
  • 9
  • 97
  • 186

3 Answers3

8

Slightly less dirty:

d = 10;
t = Table[x, {d}, {d}];
Grid[MapAt[Item[#, Frame -> White] &, t, Tuples[{Range@d, {-2, -1}}]],
     Dividers -> {#, #} &@Thread[(# -> Black &)[Range[3, d, 2]]]]

enter image description here

Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453
  • +1, however I recommend Frame -> None as this will work even if the background is not white, and it avoids altering the spacing which Frame otherwise does. – Mr.Wizard May 02 '13 at 01:29
  • @belisarius I'm confused about the negative numbers in Tuples[{Range@d, {-2, -1}}], and wondering how does it affect MapAt? I read the documentation of MapAt and did not see the case for negative numbers appear. – Lawerance Jul 23 '14 at 06:03
3

This is something of a hack because I had to adjust the Dashing parameters by eye, but maybe it will give you an idea you can chew on.

t = Table[x, {10}, {10}];
Grid[t, 
  Dividers -> 
    {{{{True, False}}, {-1 -> False, -3 -> False, 1 -> False}}, 
    {{{Dashing[{170., 100.}], False}}, {-1 -> False, 1 -> False}}}]

enter image description here

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
0

You can also use the option Frame

Grid[t, Dividers -> {#, #} & @ Thread[Range[3, 10, 2] -> True],
 Frame -> {None, None, Thread[Tuples[{Range @ 10, {-1, -2}}] -> Opacity[0]]}, 
 FrameStyle -> {Red, Thick}]

enter image description here

kglr
  • 394,356
  • 18
  • 477
  • 896