({{, (RefLink[GraphicsGrid, paclet:ref/GraphicsGrid])[{{(Subscript[g, 11]),(Subscript[g, 12]),…},…}]
generates a graphic in which the (Subscript[g, ij]) are laid out in a two-dimensional grid.}})

OpenersNotesSection(Spacer1)Details and Options

If the (Subscript[g, ij]) are graphics with (RefLink[ImageSize, paclet:ref/ImageSize])->(RefLink[Automatic, paclet:ref/Automatic]), (RefLink[GraphicsGrid, paclet:ref/GraphicsGrid]) will if possible resize them to make them fit into the grid as well as possible, while preserving their individual aspect ratios.

The output from (RefLink[GraphicsGrid, paclet:ref/GraphicsGrid]) can interactively be resized, or edited as a graphic.

The (Subscript[list, i]) in (RefLink[GraphicsGrid, paclet:ref/GraphicsGrid])[{(Subscript[list, 1]),(Subscript[list, 2]),…}] do not all need to be the same length; there will be empty space in the grid at the ends of shorter rows.

You can specify that an element e should span multiple positions in a grid using, for example, (RefLink[GraphicsGrid, paclet:ref/GraphicsGrid])[{{e,(RefLink[SpanFromLeft, paclet:ref/SpanFromLeft]),(RefLink[SpanFromLeft, paclet:ref/SpanFromLeft])},…}].

The following specify that a particular position should be spanned:

A particular element can span both multiple rows and multiple columns by having a rectangular section of the array with the form {{e,(RefLink[SpanFromLeft, paclet:ref/SpanFromLeft]),(RefLink[SpanFromLeft, paclet:ref/SpanFromLeft]),…}, {(RefLink[SpanFromAbove, paclet:ref/SpanFromAbove]),(RefLink[SpanFromBoth, paclet:ref/SpanFromBoth]),(RefLink[SpanFromBoth, paclet:ref/SpanFromBoth]),…},…}.

The following options can be given:

With (RefLink[AspectRatio, paclet:ref/AspectRatio])->(RefLink[Automatic, paclet:ref/Automatic]), the aspect ratio of the whole graphics grid will be chosen so as to best fit the individual objects in the grid.

Settings for the options (RefLink[Alignment, paclet:ref/Alignment]), (RefLink[Background, paclet:ref/Background]), and (RefLink[Frame, paclet:ref/Frame]) can be given as follows to apply separately to different items:

The (Subscript[spec, k]) can have the following forms:

With settings of the form {(Subscript[s, 1]),(Subscript[s, 2]),…,{…},(Subscript[s, m]),…,(Subscript[s, n])}, if there are more (Subscript[s, i]) specified than items across the grid, (Subscript[s, i]) from the beginning are used for the first items, and ones from the end are used for the last items.

Settings such as (RefLink[Alignment, paclet:ref/Alignment]), (RefLink[Background, paclet:ref/Background]), and (RefLink[Frame, paclet:ref/Frame]) can effectively be specified for individual items in the grid using (RefLink[Item, paclet:ref/Item]).

(RefLink[GraphicsGrid, paclet:ref/GraphicsGrid]) will not change the size of graphics or other objects that have explicit (RefLink[ImageSize, paclet:ref/ImageSize]) settings, unless the (RefLink[GraphicsGrid, paclet:ref/GraphicsGrid]) itself is resized or given an overall (RefLink[ImageSize, paclet:ref/ImageSize]) setting.

Common settings for (RefLink[Frame, paclet:ref/Frame]) include:

Settings for (RefLink[Dividers, paclet:ref/Dividers]) and (RefLink[Spacings, paclet:ref/Spacings]) can have the following forms:

The (Subscript[spec, i]) can have the same forms as for (RefLink[Alignment, paclet:ref/Alignment]), (RefLink[Background, paclet:ref/Background]), and other item-oriented options.

For a grid with n items in a particular direction, (RefLink[Dividers, paclet:ref/Dividers]) and (RefLink[Spacings, paclet:ref/Spacings]) can specify settings for the n+1 gaps between elements, starting before the first element and ending after the last element.

The following settings can be used for (RefLink[BaselinePosition, paclet:ref/BaselinePosition]):

The settings for (RefLink[BaseStyle, paclet:ref/BaseStyle]) are appended to the default style typically given by the "GraphicsGrid" style in the current stylesheet.

OpenersPrimaryExamplesSection(Spacer1)Examples  (39)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Display elements in a graphics grid:

GraphicsGrid[{{Graphics[Rectangle[]], Graphics[Disk[]]}, 
 {Graphics[Disk[]],Graphics[Rectangle[]]}}]

Put a frame around every element:

GraphicsGrid[{{Graphics[Rectangle[]], Graphics[Disk[]]}, 
 {Graphics[Disk[]],Graphics[Rectangle[]]}},Frame->All]

OpenersExampleSection1(Spacer1)Scope  (17)

OpenersExampleSubsection0(Spacer1)Frames and Grid Lines  (5)

Put a frame around the whole grid:

GraphicsGrid[Table[Graphics[Circle[]],{3},{5}],Frame->True]

Put a frame around every element:

GraphicsGrid[Table[Graphics[Circle[]],{3},{5}],Frame->All]

Draw all the frames in red:

GraphicsGrid[Table[Graphics[Circle[]],{3},{5}],Frame->All,FrameStyle->Red]

Put a frame around the first row and column:

GraphicsGrid[Table[Graphics[Circle[]],{3},{5}],Frame->{{True},{True}}]

Draw different frames with different styles:

GraphicsGrid[Table[Graphics[Circle[]],{3},{5}],Frame->{{Red},{Green}}]

Put dividers at all horizontal positions:

GraphicsGrid[Table[Graphics[Circle[]],{3},{5}],Dividers->{All,False}]

Put dividers at all vertical positions:

GraphicsGrid[Table[Graphics[Circle[]],{3},{5}],Dividers->{False,All}]

Put dividers at the third horizontal and second vertical positions:

GraphicsGrid[Table[Graphics[Circle[]],{3},{5}],Dividers->{{False,False,True},{False,True}}]

OpenersExampleSubsection1(Spacer1)Spanning Elements  (3)

Make element 4 span the column to its right:

x=Graphics[Circle[]];

GraphicsGrid[{{x,x,x},{x,SpanFromLeft,x},{x,x,x}},Frame->All]

Make it span two columns:

GraphicsGrid[{{x,x,x},{x,SpanFromLeft,SpanFromLeft},{x,x,x}},Frame->All]

Make element 2 span the row below it:

x=Graphics[Circle[]];

GraphicsGrid[{{x,x,x},{x,SpanFromAbove,x},{x,x,x}},Frame->All]

Make it span two rows:

GraphicsGrid[{{x,x,x},{x,SpanFromAbove,x},{x,SpanFromAbove,x}},Frame->All]

Span throughout a 2×2 block:

x=Graphics[Circle[]];

GraphicsGrid[{{x,SpanFromLeft,x},{SpanFromAbove,SpanFromBoth,x},{x,x,x}},Frame->All]

OpenersExampleSubsection2(Spacer1)Alignment  (1)

Align contents to the left:

GraphicsGrid[{{Graphics[Rectangle[{0,0},{5,1}]]},{Graphics[Rectangle[{0,0},{1,1}]]}},Alignment->Left,Frame->All]

Align contents to the right:

GraphicsGrid[{{Graphics[Rectangle[{0,0},{5,1}]]},{Graphics[Rectangle[{0,0},{1,1}]]}},Alignment->Right,Frame->All]

OpenersExampleSubsection3(Spacer1)Styling  (5)

Draw the grid with a pink background:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->Pink]

A pink background for the column at the first horizontal position:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->{{Pink},None}]

Alternating pink and yellow at successive vertical positions:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->{{{Pink,Yellow}},None}]

Alternating pink and yellow at successive horizontal positions:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->{None,{{Pink,Yellow}}}]

Embed styling options with a particular grid item:

x=Graphics[Circle[]];

GraphicsGrid[{{Item[x,Background->Red,Frame->True],x},{x,x}}]

OpenersExampleSubsection4(Spacer1)Spacing  (1)

Set the spacing between items:

GraphicsGrid[Table[Graphics[Circle[]],{3},{3}],Frame->All,Spacings->Scaled[.5]]

Set the horizontal and vertical spacings separately:

GraphicsGrid[Table[Graphics[Circle[]],{3},{3}],Frame->All,Spacings->{Scaled[.5],0}]

OpenersExampleSubsection5(Spacer1)Irregular Shapes  (1)

The overall aspect ratio is automatically adjusted for irregular shapes:

GraphicsGrid[Table[Graphics[Circle[],AspectRatio->RandomReal[]],{3},{5}]]

OpenersExampleSubsection6(Spacer1)Nested Grids  (1)

Grids can be nested:

x=Graphics[Circle[]];

GraphicsGrid[{{x,GraphicsGrid[{{x,x,x},{x,x,x},{x,x,x}}],x},{x,x,x}},Frame->All]

OpenersExampleSection2(Spacer1)Options  (17)

OpenersExampleSubsection7(Spacer1)AspectRatio  (2)

If possible (RefLink[GraphicsGrid, paclet:ref/GraphicsGrid]) will choose an aspect ratio suitable to its elements:

GraphicsGrid[Table[Graphics[Rectangle[],AspectRatio->RandomReal[{.2,.5}]],{5},{5}]]

When no reasonable choice can be made, a default aspect ratio of 1 is used:

GraphicsGrid[Table[Graphics[Rectangle[],AspectRatio->RandomReal[{.5,2}]],{5},{5}]]

Setting the aspect ratio of each item explicitly:

GraphicsGrid[Table[Graphics[Rectangle[],AspectRatio->RandomReal[{1,5}]],{5},{5}],AspectRatio->1]

OpenersExampleSubsection8(Spacer1)Background  (7)

Draw the grid with a pink background:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->Pink]

Pink and red backgrounds for the first and second horizontal positions:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->{{Pink,Red},None}]

An equivalent syntax:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->{{1->Pink,2->Red},None}]

Pink and red backgrounds for the first and second vertical positions:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->{None,{Pink,Red}}]

Alternating pink and red backgrounds:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->{{{Pink,Red}},None}]

Alternating backgrounds with yellow superimposed in the first and last positions:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->{{{{Pink,Red}},{1->Yellow,-1->Yellow}},None}]

Blending of colors:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->{{{Yellow,None}},{{Purple,None}}}]

Set the background for specific items:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->{None,None,{{1,1}->Pink,{3,3}->Red}}]

Set the background for a subregion of the grid:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Background->{None,None,{{{1,3},{1,3}}->Pink}}]

OpenersExampleSubsection9(Spacer1)BaselinePosition  (1)

Align the center of the grid with the baseline of surrounding text:

{x,y,GraphicsGrid[Table[Graphics[Rectangle[]],{2},{2}],Frame->True],z}

Align the bottom of the grid with the baseline:

{x,y,GraphicsGrid[Table[Graphics[Rectangle[]],{2},{2}],BaselinePosition->Bottom,Frame->True],z}

OpenersExampleSubsection10(Spacer1)Frame  (3)

Frame the entire grid:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Frame->True]

Frame all elements in the grid:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Frame->All]

Frame specific elements:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Frame->{None,None,{{1,1}->True,{3,3}->True}}]

Frame a region:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Frame->{None,None,{{{1,3},{1,3}}->True}}]

OpenersExampleSubsection11(Spacer1)FrameStyle  (3)

(RefLink[FrameStyle, paclet:ref/FrameStyle]) supports a variety of graphics directives:

GraphicsGrid[Table[Graphics[Circle[]],{4},{7}],Dividers->{2->True,False},Frame->{{True},False},FrameStyle->Directive[Dashing[.05],Thickness[.01],Blue]]

(RefLink[FrameStyle, paclet:ref/FrameStyle]) is applied to all sources of grid lines, including (RefLink[Dividers, paclet:ref/Dividers]) and (RefLink[Item, paclet:ref/Item]):

x=Graphics[Circle[]];

GraphicsGrid[{{x,x,x,x,x,x,x},{x,Item[x,Frame->Green],x,x,x,x,x},{x,x,x,x,x,x,x},{x,x,x,x,x,x,x}},Dividers->{False,2->True},Frame->{1->True,False},FrameStyle->Directive[Dashing[.05],Thickness[.01],Blue]]

Directives given with (RefLink[FrameStyle, paclet:ref/FrameStyle]) are combined with those specified elsewhere:

x=Graphics[Circle[]];

GraphicsGrid[{{x,x,x,x,x,x,x},{x,Item[x,Frame->Green],x,x,x,x,x},{x,x,x,x,x,x,x},{x,x,x,x,x,x,x}},Dividers->{2->Red,2->Red},Frame->{1->True,False},FrameStyle->Directive[Dashing[.05],Thickness[.01],Blue]]

OpenersExampleSubsection12(Spacer1)ImageSize  (1)

By default, (RefLink[GraphicsGrid, paclet:ref/GraphicsGrid]) will display graphics at their specified sizes:

GraphicsGrid[{{Graphics[Rectangle[],ImageSize->{50,50}],Graphics[Rectangle[],ImageSize->{100,100}]}}]

Giving an (RefLink[ImageSize, paclet:ref/ImageSize]) setting to the (RefLink[GraphicsGrid, paclet:ref/GraphicsGrid]) will scale the graphics appropriately:

GraphicsGrid[{{Graphics[Rectangle[],ImageSize->{50,50}],Graphics[Rectangle[],ImageSize->{100,100}]}},ImageSize->Tiny]

OpenersExampleSection3(Spacer1)Applications  (2)

Make a picture of the first 64 elementary cellular automata:

GraphicsGrid[Partition[Table[ArrayPlot[CellularAutomaton[n,{{1},0},{30,All}]],{n,0,63}],8]]

Show a collection of discrete mappings:

GraphicsGrid[Table[GraphPlot[Table[i->Mod[i^p,m],{i,m}]],{m,30,33},{p,2,5}],Frame->All]

OpenersExampleSection4(Spacer1)Possible Issues  (1)

To span across both rows and columns requires appropriate use of (RefLink[SpanFromBoth, paclet:ref/SpanFromBoth]):

x=Graphics[Circle[]];

GraphicsGrid[{{x,SpanFromLeft,x},{SpanFromAbove,SpanFromAbove,x},{x,x,x}}]

GraphicsGrid[{{x,SpanFromLeft,x},{SpanFromAbove,SpanFromBoth,x},{x,x,x}}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[GraphicsRow, paclet:ref/GraphicsRow])  ▪  (RefLink[GraphicsColumn, paclet:ref/GraphicsColumn])  ▪  (RefLink[Grid, paclet:ref/Grid])  ▪  (RefLink[GalleryView, paclet:ref/GalleryView])  ▪  (RefLink[Inset, paclet:ref/Inset])  ▪  (RefLink[ImageAssemble, paclet:ref/ImageAssemble])  ▪  (RefLink[ImageCollage, paclet:ref/ImageCollage])  ▪  (RefLink[WordCloud, paclet:ref/WordCloud])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Grids, Rows, and Columns, paclet:tutorial/GridsRowsAndColumnsOverview])}, {▪(RefLinkPlain[Redrawing and Combining Plots, paclet:tutorial/RedrawingAndCombiningPlots])}, {▪(RefLinkPlain[Formatted Output, paclet:tutorial/FormattedOutput])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Graphics Options & Styling, paclet:guide/GraphicsOptionsAndStyling])}, {▪(RefLinkPlain[Annotating & Combining Graphics, paclet:guide/AnnotatingAndCombiningGraphics])}, {▪(RefLinkPlain[Layout & Tables, paclet:guide/LayoutAndTables])}, {▪(RefLinkPlain[Combining Graphics, paclet:guide/CombiningGraphics])}, {▪(RefLinkPlain[Grids & Tables, paclet:guide/GridsAndTables])}, {▪(RefLinkPlain[Data Visualization, paclet:guide/DataVisualization])}, {▪(RefLinkPlain[Symbolic Graphics Language, paclet:guide/SymbolicGraphicsLanguage])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/24-more-forms-of-visualization.html])(WebLink[: More Forms of Visualization, https://www.wolfram.com/language/elementary-introduction/24-more-forms-of-visualization.html])}})}})