Group Abstract Group Abstract

Message Boards Message Boards

0
|
1.5K Views
|
8 Replies
|
7 Total Likes
View groups...
Share
Share this post:

Help with Alignment option

Say I have the grid shown below. What should the Alignment option be to create the intended positions without using a rule for every cell?

Grid[
 {{"Left\nTop", "Center\nTop", "Right\nTop", "Left\nTop", 
   "Center\nTop", "Right\nTop"},
  {"Left\nCenter", "Center\nCenter", "Right\nCenter", "Left\nCenter", 
   "Center\nCenter", "Right\nCenter"},
  {"Left\nBottom", "Center\nBottom", "Right\nBottom", "Left\nBottom", 
   "Center\nBottom", "Right\nBottom"},
  {"Left\nTop", "Center\nTop", "Right\nTop", "Left\nTop", 
   "Center\nTop", "Right\nTop"},
  {"Left\nCenter", "Center\nCenter", "Right\nCenter", "Left\nCenter", 
   "Center\nCenter", "Right\nCenter"},
  {"Left\nBottom", "Center\nBottom", "Right\nBottom", "Left\nBottom", 
   "Center\nBottom", "Right\nBottom"}},
 Frame -> All, Spacings -> {15, 5},
 Alignment -> {{Left, Center, Right}, {Top, Center, Bottom}}]
POSTED BY: Jay Gourley
8 Replies

You are right, Hans Milton. I had not seen that tech note. I didn't realize until I read your post, that it is one of the documents with a link in the Alignment documentation.

POSTED BY: Jay Gourley

Thanks, Eric Rimbey. Very helpful.

POSTED BY: Jay Gourley

Well done, Michael Rogers. Your explanation with its well-chosen example is especially helpful. In my opinion, your example should be added to the Alignment documentation. Contrasting the cyclic arguments with the non-cyclic ones is an effective way to illustrate how to use cycling, and your explanation eliminated any ambiguity remaining in the example.

POSTED BY: Jay Gourley
Posted 7 months ago

There's a one-line reference in the documentation about how to cycle arguments

Jay, there is a lot more in the documentation. Check this: Grids, Rows and Columns.

POSTED BY: Hans Milton

Consider:

Grid[
 Table[Row[{i, j}], {i, 10}, {j, 10}],
 ItemSize -> {3, 2},
 Dividers -> All,
 Alignment -> {
     {Left, {Left, Right, Center}},
     {Top, Top, {Top, Center, Bottom}}}
 ]

The horizontal alignments go:

Left | Left Right Center | Left Right Center | Left Right Center 

The vertical bars signal where the cyclic alignments (re)start. The first Left is because of the explicit alignment specified before the cycle indicated by {Left, Right, Center}. The vertical alignments are parsed similarly. The main difference is that the alignments of the first two rows are specified before the cycle. The vertical alignments go:

Top Top | Top Center Bottom | Top Center Bottom | Top Center

They end mid cycle at the 10th row.

POSTED BY: Michael Rogers
Posted 7 months ago

The suggestion I gave you,

Alignment -> {{{Left, Center, Right}}, {{Top, Center, Bottom}}}

is an example of how to specify the cycling. Notice the extra layer of List.

POSTED BY: Eric Rimbey

Thanks, Eric Rimbey. Correcting my misunderstanding about Spacings was helpful. Also the suggestion about Alignment, eliminated some of my uncertainty. I'm still curious about the possibility of "cycling" the arguments for Alignment. That's the reason I specified only three arguments each for horizontal and vertical placement. I was hoping I could make them cycle through the rest of the grid. There's a one-line reference in the documentation about how to cycle arguments. With my limited experience, it was too vague to interpret, and there were no examples. So I'm not even sure if I know what was meant by the brief reference in the documentation.

The Subscript[spec, k] can have the following forms:
 ... 
 {{Subscript[c, 1],Subscript[c, 2],\[Ellipsis]}}... cycle through all Subscript[c, i]
 ...
POSTED BY: Jay Gourley
Posted 7 months ago

I believe the alignment setting you want is

Alignment -> {{{Left, Center, Right}}, {{Top, Center, Bottom}}}

However, given all of the other options you've provide, it will be difficult to actually see the alignment effect. The Spacings option doesn't change the size of the content area of the cells, just the spacing between the content areas. Replace the Spacings option with

ItemSize -> {10, 5}

and you'll be able to see the alignments.

POSTED BY: Eric Rimbey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard