Re: Grids
- To: mathgroup at smc.vnet.net
- Subject: [mg131366] Re: Grids
- From: "djmpark" <djmpark at comcast.net>
- Date: Mon, 1 Jul 2013 05:51:18 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <13090651.71529.1372577587340.JavaMail.root@m06>
I'm fairly certain you will get a simpler answer to this, but I have fancied up your table a little just for illustration. I used thick lines in some places and thin lines for the dividers between the rows of values. I used two different background colors, one for the headings and another for the values. And I used a special font for the heading labels. I did this using the TableMaker facility in the Presentations Application. (However, below I also give the regular Grid expression so you can see what the table looks like.) TableMaker allows one to "draw" a table just as one might draw a graphic. There are commands for inserting blocks of table values, drawing Frames and Dividers, specifying Alignments, Spacings, Backgrounds and styles. The tables is displayed in the notebook but a palette is also produced that shows the form of the table and from which one can paste positions, given by {row, column}, into the command. One can keep adding items and reevaluating. << Presentations` x1 = Range[-3, 3]; g[x1_] := x1^2; y1 = g[x1]; tableExpression = MakeTable[x1y1Table, 8, 2][ TMSubmatrix[{1, 1}, {{"xVal", "yVal"}}], TMItemStyle["Row", Directive[Bold, FontFamily -> "Century"], {1, 1}], TMSubmatrix[{2, 1}, Transpose[{x1}]], TMSubmatrix[{2, 2}, Transpose[{y1}]], TMFrame["Block", Thick, {1, 1}, {8, 2}], TMDividers["CenterRows", Black], TMDividers["CenterColumns", Thick], TMDividers["Row", Thick, {1, 1}, After], TMBackground["Row", ColorData["Legacy"]["Bisque"], {1, 1}], TMBackground["Block", ColorData["Legacy"]["LemonChiffon"], {2, 1}, {8, 2}] ] The generated Grid expression can be obtained by: tableExpression // InputForm Grid[{{"xVal", "yVal"}, {-3, 9}, {-2, 4}, {-1, 1}, {0, 0}, {1, 1}, {2, 4}, {3, 9}}, Dividers -> {{2 -> Thickness[Large]}, {2 -> GrayLevel[0], 3 -> GrayLevel[0], 4 -> GrayLevel[0], 5 -> GrayLevel[0], 6 -> GrayLevel[0], 7 -> GrayLevel[0], 8 -> GrayLevel[0], 2 -> Thickness[Large]}}, Spacings -> {{None, {}}, {None, {}}}, Background -> {{}, {}, {{{1, 1}, {1, 2}} -> RGBColor[1., 0.898053, 0.771844], {{2, 8}, {1, 2}} -> RGBColor[1., 0.980407, 0.803903]}}, Frame -> {{}, {}, {{{1, 8}, {1, 2}} -> Thickness[Large]}}, ItemStyle -> {{}, {}, {{{1, 1}, {1, 2}} -> Directive[Bold, FontFamily -> "Century"]}}, ItemSize -> {{Automatic, {}}, {Automatic, {}}}, Alignment -> {{Center, {}}, {Center, {}}, {}}, BaseStyle -> {14, Plain, FontFamily -> "Times"}] That would be the normal way of specifying the table. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/index.html From: Mark [mailto:big.dog1 at att.net] Hello: ' I am trying to get the x1 and y1 results of a basic function displayed in two columns with a grid around each x1 and y1 entry. ' However, my result only appears with a grid around the exterior of the x1 and y1 values, and the only the column headings. There is a vertical divider between the x1 and y1 columns, but the row dividers are missing. What is the syntax to get the row dividers to appear? Thanks in advance, and below is what I have tried so far: x1 = Range[-3, 3](*Define the range of x1 values.*) g[x1_] := x1^2(*Define the function*) y1 = g[x1](*Calculate the y values of the function*) Out[21]= {9, 4, 1, 0, 1, 4, 9} '--------------------------------------- ' Grid[{{xVal, yVal}, {Column[x1], Column[y1]}}, Frame -> All](*The result of this function in columar format*) '--------------------------------------- ' I also tried the the below statement as well but it gives the same result. Grid[{{xVal, yVal}, {Column[x1], Column[y1]}}, Frame -> All, Dividers -> All] Mark