Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In the documentation for GraphicsGrid, it says

By default, GraphicsGrid will display graphics at their specified sizes

So why does it rescale the 3d plots even if I have set the ImageSize option?

For example:

GraphicsGrid@Table[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, ImageSize -> 200], {2}, {2}]

gives the scaled 3d plots, regarding I have set the image size

enter image description here

while it doesn't rescale the 2d plots

enter image description here

So why does GraphicsGrid rescale 3d plots?

share|improve this question
1  
I believe that by "graphics", the documentation is tacitly referring to Graphics, and not Graphics3D –  rasher May 25 at 6:53
    
If so, could be a bit clearer?! –  blochwave May 25 at 10:08
    
@rasher That's confusing, because in the documentation of Grid, it says "Grid will not change the size of graphics or other objects that have explicit ImageSize settings. " and it does not rescale 3d plots. –  xslittlegrass May 25 at 15:10

2 Answers 2

up vote 4 down vote accepted

I tried using {200,200} to specify width and height instead of just width (200), and for some reason I was able to specify the size of the 3D plots i.e. stop the rescaling. I suspect that 3D plots need to be specified in more dimensions than their 2D counterparts in order to be displayed properly at the size you want.

Here's a summary of the codes and outputs I tested. Strangely when I included 2 squares at the end to check the size of mine and eldo's solutions, neither of ours match the size of the squares. I'm not sure if that's the fault of our solutions or of the squares being improperly set up. I'm a newbie at Mathematica--waiting for my copy of Mathematica Navigator to arrive(!)--so I may very well not know what the heck I'm doing.

PS: I'm also a college student in LA! Not at LSU though.

{
  (*OP's situation: changing ImageSize does not change size of plots in grid*)
  {GraphicsGrid[
    Table[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
      ImageSize -> 200], {2}, {2}], Frame -> All], 
   GraphicsGrid[
    Table[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
      ImageSize -> 100], {2}, {2}], Frame -> All]},

  (*My--seismatica's--suggestion: use {w,h} to specify width & height instead of just width*)
  {GraphicsGrid[
    Table[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
      ImageSize -> {200, 200}], {2}, {2}], Frame -> All],
   GraphicsGrid[
    Table[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
      ImageSize -> {100, 100}], {2}, {2}], Frame -> All]},

  (*eldo's suggestion: use Grid*)
  {Grid[Table[
     Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
      ImageSize -> 200], {2}, {2}], Frame -> All],
   Grid[Table[
     Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
      ImageSize -> 100], {2}, {2}], Frame -> All]},

  (*Squares of specified dimensions, for reference*)
  {Graphics[Rectangle[], ImageSize -> 200],
   Graphics[Rectangle[], ImageSize -> 100]}
  } // TableForm

Output comparisons

Edit: I suspected the mismatch in size (between the plots and the reference square) is due to padding of (Graphics)Grid. However, after removing the padding--by setting Spacings to {0,0}, the mismatch is still there. Also, for some reason, eldo's grid loses the internal horizontal frame after removing spacing. Not quite sure what's going on :/

{
  (*OP's situation: changing ImageSize does not change size of plots in grid*)
  {GraphicsGrid[
    Table[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
      ImageSize -> 200], {2}, {2}], Frame -> All, Spacings -> {0, 0}],
    GraphicsGrid[
    Table[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
      ImageSize -> 100], {2}, {2}], Frame -> All, Spacings -> {0, 0}]},

  (*My--seismatica's--suggestion: use {w,h} to specify width & height instead of just width*)
  {GraphicsGrid[
    Table[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
      ImageSize -> {200, 200}], {2}, {2}], Frame -> All, 
    Spacings -> {0, 0}],
   GraphicsGrid[
    Table[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
      ImageSize -> {100, 100}], {2}, {2}], Frame -> All, 
    Spacings -> {0, 0}]},

  (*Squares of specified dimensions, for reference*)
  {Graphics[Rectangle[], ImageSize -> 200],
   Graphics[Rectangle[], ImageSize -> 100]},

  (*eldo's suggestion: use Grid*)
  {Grid[Table[
     Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
      ImageSize -> 200], {2}, {2}], Frame -> All, Spacings -> {0, 0}],
   Grid[Table[
     Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
      ImageSize -> 100], {2}, {2}], Frame -> All, Spacings -> {0, 0}]},
  } // TableForm

Output comparisons without padding

share|improve this answer
    
Please include any relevant code, not just images. –  Sektor May 25 at 12:04
    
Thanks :) Which college are you at? –  xslittlegrass May 25 at 23:10
    
I'm at UL ;) ugh10char –  seismatica May 26 at 1:17

I would use:

Grid@Table[
  Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, 
   ImageSize -> 300], {2}, {2}]
share|improve this answer
    
Adding an image facilitates quick evaluation of the result. Try the excellent Image Uploader pallette: meta.mathematica.stackexchange.com/q/5/131 –  Yves Klett May 30 at 11:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.