4
$\begingroup$

I'm trying to align elements in Grid/GraphicsGrid:

Grid[{{a,b,c},{d,e}}]

This makes d,e aligned to the very left of the bottom row. When I do

Grid[{{a,b,c},{d,SpanFromLeft,e}}]

only d is in a position where I want it. What to do to have e placed just next to d (or, in other words, between b and c)? Unfortunately, there is no SpanFromRight (why?).

Thanks in advance!

EDIT: I'm in fact interested in GraphicsGrid; I thought that Grid will be sufficient to convert it, but the plots look terrible (below) or are totally misaligned (when plaing with ImageSize, especially when I go to Grid[{{a,b,c,d},{e,f,g}}], where a,...,g are ListContourPlots with Legend:

enter image description here

EDIT2: The layout and formatting now seem to be perfect, but... Probably it should now be switched to Export problems. I have a nice looking output in MMA, but after Export to .eps I get this result (placings should be as shown above) (converted to from .eps output to .jpg 'cause size limit):

enter image description here

$\endgroup$
9
$\begingroup$

Maybe

Column[Row[#, Spacer[5]] & /@ {{a, b, c}, {d, e}},  Alignment -> Center]

enter image description here

{a, b, c, d, e, f, g, h, i} = 
  Table[With[{data = MapIndexed[Flatten[{##}] &, RandomReal[1, {100, 2}]], 
     color = RandomChoice[ColorData["Gradients"]], 
     intord = RandomInteger[{0, 4}]}, 
    ListDensityPlot[data, InterpolationOrder -> intord, ColorFunction -> color,
     Mesh -> All, ImageSize -> 200, ImagePadding -> {{20, 5}, {20, 5}}, 
     PlotLegends -> BarLegend[Automatic, LegendMarkerSize -> 200]]], {9}];

Column[Row[#, Spacer[5]] & /@ {{a, b, c, d}, {e, f, g}, {h, i}}, Alignment -> Center]

enter image description here

$\endgroup$
5
$\begingroup$

Well, what you want is not really a simple grid, because its irregular, but a combination of two grids:

Grid[{{Grid[{{a, b, c}}]}, {Grid[{{d, e}}]}}]

The other thing you can try is to construct it by rows and columns:

Column[{Row[{a, b, c}, " "], Row[{d, e}, " "]}, Center]

Here's nice overview of all this stuff:

https://reference.wolfram.com/language/tutorial/GridsRowsAndColumns.html

$\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.