# Creating a grid of plots [duplicate]

This question already has an answer here:

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];
Return[p]]

Manipulate[
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.

-

## marked as duplicate by Jens, Mr.Wizard♦Jul 7 '13 at 17:32

Look at GraphicsGrid. –  Jens Jul 3 '13 at 21:37
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 –  Yyrkoon Jul 3 '13 at 21:42
@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... –  cormullion Jul 3 '13 at 21:53
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. –  Pickett Jul 3 '13 at 22:18
Possible duplicate: (6877) –  Mr.Wizard Jul 5 '13 at 6:49

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]


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.

-
aaaah, my eyes. –  s0rce Jul 4 '13 at 0:31
@s0rce He did say it's a 6x6 grid... but better not look directly at it for more than 2 seconds. –  Jens Jul 4 '13 at 2:26
Jens, do you not think this question is effectively a duplicate of the one you linked? –  Mr.Wizard Jul 7 '13 at 17:14
@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. –  Jens Jul 7 '13 at 17:31
Thanks; closed. –  Mr.Wizard Jul 7 '13 at 17:32
show 1 more comment

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:

GraphicsGrid[plots]


However, with ImageSize they can be made arbitrarily large:

GraphicsGrid[plots, ImageSize -> 1000]

-
I also wasn't able to make much of the example code in the question, so +1 for giving the "most likely" solution. –  Jens Jul 4 '13 at 0:02
Thank you, I've tried also your suggestion but i was still having the same problem! –  Yyrkoon Jul 9 '13 at 9:51