I'm really a noob on Mathematica. I would like to create a layout of multiple plots in Mathematica.

I've a function that calculates the solution, over time, of a system of differential equations. The results are to be plotted. In order to compare different solutions, I want a plot showing a 6X6 grid of LogPlots.

I'm adding an example of my code

function[a0_, b0_, c0_, d0_, e0_, f0_] :=
  Block[{replacerules, sssol},
    replacerules = {a -> a0, b -> b0, c -> c0, d -> d0};
    sssol  = NSolve[Sys /. replacerules, {x,y,z}], ];
    numint = NDSolve[ SysDiff /. sssol ,{x,y,z},{t, 0, 100},];
    p = LogPlot[x[t] /.numint, y[t] /.numint, z[t] /.numint];

  GraphicsGrid[ Table[function[a, b, c, d, e, f], 
  {a, -1, 4}, 
  {b, -1, 4}]],
  {c, -10, -4},
  {d,  -4,  2, 1},
  {e,   1, 20, 1}]

This is a really really simplified version of the code. I hope it can help.

My function takes as input some parameters and uses them to calculate the solution of a system of differential equations. Then everything is plotted with the help of Manipulate and Table to combine different parameters values.

  • $\begingroup$ Look at GraphicsGrid. $\endgroup$
    – Jens
    Jul 3, 2013 at 21:37
  • $\begingroup$ I've been trying to use it, but it gives me a matrix of subplot where is almost not possible to see nothing(the size of the Plot are to small and they don't show not even a small part of the wawes). So I was wondering if there is a better way to do it $\endgroup$
    – Yyrkoon
    Jul 3, 2013 at 21:42
  • 1
    $\begingroup$ @Yyrkoon Try adding to your question a simplified example of your code - people may be able to suggest how you can improve it. Without seeing it, it's hard to say what can be improved... $\endgroup$
    – cormullion
    Jul 3, 2013 at 21:53
  • 1
    $\begingroup$ I did not manage to execute your code, there appears to be some errors in it. But I think that in principle my answer stands. Try ImageSize. $\endgroup$
    – C. E.
    Jul 3, 2013 at 22:18
  • $\begingroup$ Possible duplicate: (6877) $\endgroup$
    – Mr.Wizard
    Jul 5, 2013 at 6:49

2 Answers 2


Assuming Anon's interpretation of your question is correct, you could also use the answer I gave here. Just copy the code from that answer, starting with

Options[plotGrid] = {ImagePadding -> 40};
plotGrid[l_List, w_, h_, opts : OptionsPattern[]] := ...

and then execute the following to get a grid of log plots that all share their common axes:

pt = Table[
   LogPlot[{x^{m x}, Exp[n x], x!}, {x, 1, 5}, Axes -> None, 
    Frame -> True, FrameTicks -> All, PlotRangePadding -> {0.2, .8}, 
    GridLines -> Automatic, PlotRange -> {1.1, 20000}], {m, 1, 6}, {n,
     1, 6}];

plotGrid[pt, 600, 600]

log grid

Here, I added the logarithmic grid lines just for illustration. Also, you could adjust PlotRangePadding to move the frame labels further away from each other. This kind of dense packing of plots works best if you make sure all plots have the same PlotRange, as I did above.

In the function plotGrid I'm using here, the first argument is the list of plots to be arranged on a grid, and the next two arguments are the ImageSize dimensions of the overall plot.

  • 1
    $\begingroup$ aaaah, my eyes. $\endgroup$
    – s0rce
    Jul 4, 2013 at 0:31
  • $\begingroup$ @s0rce He did say it's a 6x6 grid... but better not look directly at it for more than 2 seconds. $\endgroup$
    – Jens
    Jul 4, 2013 at 2:26
  • $\begingroup$ Jens, do you not think this question is effectively a duplicate of the one you linked? $\endgroup$
    – Mr.Wizard
    Jul 7, 2013 at 17:14
  • $\begingroup$ @Mr.Wizard I had been hoping to get some feedback for clarification, but it looks like there's nothing more to it, and in that case it really is effectively a duplicate. $\endgroup$
    – Jens
    Jul 7, 2013 at 17:31
  • $\begingroup$ Sorry for the delay, Thank you so much it worked! $\endgroup$
    – Yyrkoon
    Jul 9, 2013 at 9:51

Here's some code that demonstrates your problem and the solution.

plots = Table[Plot[a x^b, {x, 0, 2}], {a, 1, 6}, {b, 1, 6}];

Without ImageSize, as you mention, the plots are really small using GraphicsGrid:


However, with ImageSize they can be made arbitrarily large:

GraphicsGrid[plots, ImageSize -> 1000]
  • $\begingroup$ I also wasn't able to make much of the example code in the question, so +1 for giving the "most likely" solution. $\endgroup$
    – Jens
    Jul 4, 2013 at 0:02
  • $\begingroup$ Thank you, I've tried also your suggestion but i was still having the same problem! $\endgroup$
    – Yyrkoon
    Jul 9, 2013 at 9:51

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