Sometimes I have occasion to make big grids of plots. As a toy example:

lots = GraphicsGrid[
Table[With[{a = RandomInteger[{1, 17}], b = RandomInteger[{1, 17}]},
  ParametricPlot[Sin[t^2] { Cos[a t], Sin[b t]}, {t, 0, 2 \[Pi]}, 
     PlotRange->{{-1, 1}, {-1, 1}}, Frame->True]], {15}, {7}]]

Which is a 7 by 15 grid of plots. For ease of viewing, printing and wider distribution; I will often export this to a pdf.

Export["lots.pdf", lots]

This results in a completely rubbish view. You get giant text labels and a graph too small to even see. This can be rectified by fiddling with the scaling:

Export["lots.pdf", lots, ImageSize->2000]

Now the text labels are more in proportion with the graph size. But how do I know what ImageSize should be? It depends on how big your graphic grid is, but I know not the voodoo required to get a good result.

Alternatively, how can I get the text size to be proportional to the graph size?

  • $\begingroup$ Related: "How can I scale a plot in vector graphic or PDF form?" $\endgroup$ Commented Aug 7, 2016 at 14:36
  • $\begingroup$ @Alexey I have typically been making links from newer questions to older ones. This causes a link to appear in the Linked sidebar of both questions. Do you have a reason to prefer linking from the older one to the newer one in this case? $\endgroup$
    – Mr.Wizard
    Commented Aug 7, 2016 at 15:33
  • $\begingroup$ @Mr.Wizard I didn't know this feature. But currently the link does appear in the Linked sidebar of both questions. $\endgroup$ Commented Aug 7, 2016 at 15:51

2 Answers 2


You should investigate in the Scaled function:

lots = GraphicsGrid[
   Table[With[{a = RandomInteger[{1, 17}], 
      b = RandomInteger[{1, 17}]}, 
     ParametricPlot[Sin[t^2] {Cos[a t], Sin[b t]}, {t, 0, 2 \[Pi]}, 
      PlotRange -> {{-1, 1}, {-1, 1}}, Frame -> True, 
      ImageSize -> Scaled[1]]], {15}, {7}]];
Export["lots.pdf", lots]

enter image description here

  • $\begingroup$ This solution also works for discrete ImageSize values. $\endgroup$
    – Yves Klett
    Commented Mar 1, 2012 at 8:09
  • $\begingroup$ I am not sure if you realize that ImageSize -> Scaled[1] means that the image width should be the same as the notebook width (which is an unpredictable value). How it gets interpreted within a GraphicsGrid/Inset and I am not quite sure. $\endgroup$
    – Szabolcs
    Commented Mar 1, 2012 at 9:12
  • $\begingroup$ @Szabolcs, no I was not aware of that. Can you point out where I find this in the docu, because here it does never make a difference how big the notbook is. The pdf is the same. Furthermore, the docu says: "Specify ImageSize by a fraction of the enclosing region" if Scaled is used for ImageSize $\endgroup$
    – halirutan
    Commented Mar 1, 2012 at 10:52
  • $\begingroup$ @halirutan I don't, but if you find where it is documented, let me know. This aspect of figure creation causes me constant frustration. The enclosing region in this case is the notebook, and I find that ImageSize -> Scaled[1] makes the figure fill the notebook. It is generally a problem with exporting figures or other content that they are created by the front end which lives on a computer screen, and it's behaviour is influenced by the state of the GUI and desktop environment. I found this when experimenting with ... $\endgroup$
    – Szabolcs
    Commented Mar 1, 2012 at 11:16
  • $\begingroup$ ... (the undocumented) ExportPacket, which seems to be the basis of many graphics export operations as well as Rasterize. $\endgroup$
    – Szabolcs
    Commented Mar 1, 2012 at 11:17

Why this happens?

The reason for this behaviour is that Mathematica works with two kinds of units:

  • plot coordinates---the same thing you see on the axes

  • offset coordinates---these are in printer's points

Plot coordinates scale with the figure: if you print the figure (or export to PDF) at twice the size, objects specified on plot coordinates double in size. But offset coordinates do not scale: if the font size is 10 pt, it will be 10 pt no matter how big the figure.

The default graphics size is 360 pt wide (12.7 cm). When you specify the size using ImageSize, it is also understood in points. When using a 10 pt font size and having seven figures in a row, this'll make the tick labels pretty crowded.

This behaviour can cause problems (especially because the space left for the tick labels is also determined in offset coordinates), but can be very useful too when one needs to ensure that the fonts of the exported figure are at the correct size (e.g. 8 pt and no smaller).

Possible solutions

Now that you understand why this happens, you can make a good judgement about what ImageSize to choose when exporting, and what font size to use.

Sometimes it's desirable to have the text scale with the figure: Mathematica has a third kind of unit for this, Scaled units (as @halirutan described). This lets you specify e.g. the font size as a fraction of the plot range width:

Plot[Sin[x], {x, 0, 10}, BaseStyle -> {FontSize -> Scaled[0.04]}]

When you resize this, the text scales with the figure.

For completeness, there is also a fourth type of unit, ImageScaled. This lets you specify sizes as a fraction of the full figure width, including the space left for tick labels (not only the plot range---i.e. the area inside the frame).

I find that this multitude of unit types is useful sometimes (when exporting figures to size), but at other times it makes it really difficult to achieve what I want, especially when trying to make tightly packed plot grids and specify the full size of the grid. Related: Sizing cells in a GraphicsGrid/GraphicsRow

  • 1
    $\begingroup$ I found that using something like FontSize -> Scaled[0.04] ends up clipping things like frame labels. $\endgroup$
    – wxffles
    Commented Mar 1, 2012 at 19:19
  • 1
    $\begingroup$ @wxffles You are right. That is because ImagePadding is fixed. It doesn't appear to be possible to specify ImagePadding in terms of the image width (Scaled scaled relative to the notebook width), so this is not a good solution for frames. What remains is choosing an appropriate ImageSize. $\endgroup$
    – Szabolcs
    Commented Mar 1, 2012 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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