I'm trying to make a Grid
that has one cell that spans horizontally and one that spans vertically, like so (generated manually with Graphics
):
But when I try to do this with Grid, the right-most vertical cell doesn't span both rows:
Grid[{
{ Style["1", FontSize->30], SpanFromLeft, Style["4\n4", FontSize->30] },
{ Style["2", FontSize->30], Style["3", FontSize->30], SpanFromAbove }
}, Frame->All, Spacings->{3,3} ]
Since I have the frame active, I know the right-most cell does in fact span both rows, as we see if we remove SpanFromAbove
:
Grid[{
{ Style["1", FontSize->30], SpanFromLeft, Style["4\n4", FontSize->30] },
{ Style["2", FontSize->30], Style["3", FontSize->30] }
}, Frame->All, Spacings->{3,3} ]
Is it not possible to combine vertical and horizontal spans in a grid? Is there a better function, like some combination of Column
and Row
? Thx
Alignment -> {Center, Center}
you can see that the item with 4s is streched. Or did I miss the point?Grid[{{Style["1", FontSize -> 30], SpanFromLeft, Style["4\n4", FontSize -> 30]}, {Style["2", FontSize -> 30], Style["3", FontSize -> 30], SpanFromAbove}}, Frame -> All, Spacings -> {3, 3}, Alignment -> {Center, Center}]
$\endgroup$Grid[{{Style["1", FontSize -> 30], SpanFromLeft, Style["4\n4\n4\n4\n", FontSize -> 30]}, {Style["2", FontSize -> 30], Style["3", FontSize -> 30], SpanFromAbove}}, Frame -> All, Spacings -> {3, 3}, Alignment -> {Center, Center}]
$\endgroup$Grid
withGraphicsGrid
. Seems like a bug to me. $\endgroup$Alignment
shows this. @ChrisWilson misses seeing this in part because of an extra newline at the end...try wrappingFramed
around theStyle
or usingBottom
alignment. What it cannot do is to calculate the required height of the first row correctly. It apportions to the first row enough pixels to hold everything, although it could have subtracted the number of vertical pixels in the second row. $\endgroup$