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.

I am trying to use GraphicsGrid to typeset some labels for my plots. I found the labels look little better when I use GrapicsGrid vs Grid. The labels have equations in them and not just plain labels.

I just do not know how to make a GraphicsGrid which has no wasted space in it.

Here is an example using Grid, which does not have the problem of wasted space, and same example, using GraphicsGrid. Ps. in this example, I am using a nice little makeBoxes function I found on the net by P.J. Hinton to make Derivatives in Traditionalform come out like they are in our textbook. Here is a link to the original post if needed

Remove["Global`*"];
MakeBoxes[Derivative[indices__][f_][vars__], TraditionalForm] := 
  SubscriptBox[MakeBoxes[f, TraditionalForm], 
   RowBox[Map[ToString, 
     Flatten[Thread[dummyhead[{vars}, Partition[{indices}, 1]]] /. 
       dummyhead -> Table]]]];

title = 2 Derivative[2, 0][u][x, t] == 
   1.1 Derivative[0, 1][u][x, t] + 80 Derivative[1, 0][u][x, t];

title = Style[title, 16];

GraphicsGrid[{{Item[title, Alignment -> Top], SpanFromLeft}}, 
 ImageSize -> {150, 80}, Frame -> All, ImageMargins -> 0, 
 ImagePadding -> 0, BaselinePosition -> Center]

This gives

enter image description here

and using normal Grid, gives (noticed I had to call TraditionalForm once more here, but not with the above to get it to work)

Remove["Global`*"];
MakeBoxes[Derivative[indices__][f_][vars__], TraditionalForm] := 
  SubscriptBox[MakeBoxes[f, TraditionalForm], 
   RowBox[Map[ToString, 
     Flatten[Thread[dummyhead[{vars}, Partition[{indices}, 1]]] /. 
       dummyhead -> Table]]]];

tr = TraditionalForm;
title = 2 tr@Derivative[2, 0][u][x, t] == 
   1.1 tr@Derivative[0, 1][u][x, t] + 80 tr@Derivative[1, 0][u][x, t];

title = Style[title, 16];
Grid[{{Item[title, Alignment -> Top], SpanFromLeft}}, Frame -> All]

enter image description here

Played around with GraphicsGrid, but can't figure how to automatically tell it to put the object inside it as tight as possible. It will be best if I do not not specify ImageSize. But using ImageSize-> Automatic does not work:

GraphicsGrid[{{Item[title, Alignment -> Top], SpanFromLeft}}, 
 ImageSize -> Automatic, Frame -> All, ImageMargins -> 0, 
 ImagePadding -> 0, BaselinePosition -> Center]

enter image description here

Is there an option or a trick to do this?

thanks

share|improve this question
1  
Why not just use PlotLabel (or even FrameLabel) on the individual plots? –  J. M. Jan 28 '12 at 2:01

1 Answer 1

up vote 9 down vote accepted

I prefer Framed. To improve labels just wrap TraditionalForm around it:

TraditionalForm@Framed[title]

enter image description here

If you have many cells and if the whole point is to make a tight grid and have nice labels, you could improve labels in Grid, rather then improving spacing in GraphicsGrid:

TraditionalForm[Grid[{{title}, {title}}, Frame -> All]]

enter image description here

GraphicsGrid is to handle graphics. Just for the sake of completeness you could simply Rasterize your formula to Graphics to make GraphicsGrid work:

GraphicsGrid[{{Rasterize@TraditionalForm[title]}}, Frame -> All]

enter image description here

share|improve this answer

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.