4
$\begingroup$

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?

$\endgroup$
8
$\begingroup$

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

$\endgroup$
  • $\begingroup$ +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. $\endgroup$ – Mr.Wizard May 2 '13 at 1:29
  • $\begingroup$ @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. $\endgroup$ – Lawerance Jul 23 '14 at 6:03
3
$\begingroup$

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

$\endgroup$
  • 2
    $\begingroup$ Really dirty :D $\endgroup$ – Dr. belisarius May 1 '13 at 22:54
0
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.