3
$\begingroup$

It seems that both Grid and GraphicsGrid can display graphics. Following the documentation here tutorial/GridsRowsAndColumns#391204127, and avoiding screen shots, if

g$={{Graphics[Rectangle[{0, 0}], ImageSize -> 20], Graphics[Disk[{0, 0}], ImageSize -> 20]}, 
    {Graphics[Disk[{0, 0}], ImageSize -> 20], Graphics[Rectangle[{0, 0}], ImageSize -> 20]}}

then Grid[g$] and GraphicsGrid[g$] produce similar-looking output in a notebook, the only evident difference being padding. Are there other non-obvious differences? Any use-case advice, as in when to choose one or the other?

$\endgroup$
2
$\begingroup$

GraphicsGrid produces a Graphics object, which could be placed within another graphic or otherwise treated as a Graphics object, such as scaling, rotating, etc. You can also, for instance, determine ImageDimensions[GraphicsGrid[...]]. Grid does not produce a graphics object; ImageDimensions[Grid[...]] yields an error. And so forth.

$\endgroup$
  • $\begingroup$ Sorry, did not see your answer when writing mine, but is the same. $\endgroup$ – penguin77 Mar 30 '15 at 22:21
3
$\begingroup$

uuhahh, there is an important big difference.

Grid returns a Grid object whereas GraphicsGrid returns an Image. Therefore you will be able to apply all Image functions to GraphicsGrid as a whole, whereas this is not possible on a Grid as a whole. Here an example to illustrate, try to use ImageRotate in both cases and see what is happening :

Case 1:

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

Case 2:

  ImageRotate[Grid[{{Graphics[Rectangle[]], Graphics[Disk[]]}, 
       {Graphics[Disk[]], Graphics[Rectangle[]]}}],90]

with following error for case 2:

ImageRotate::imginv: (("\"Expecting an image or graphics instead of ....

HINT: use //InputForm for analyzing and to get better understanding of high level expressions

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