4
$\begingroup$

I seek to save my plots without having to save them one at a time. To give you an idea of what I am working with. I am dealing with the eigenbasis of a 50 by 50 tridiagonal matrix. I have plotted each of the columns using the following Do loop.

Do[Print[ListLinePlot[MatSE[[51 - j]]]], {j, 50}]

Is there is a easier way to save all these images without having to save them one at a time?

On a side note. Is there a way I can create a GraphicGrid of my plots without having to entry each plot at a time.


Sorry for the very short question. If you need me to give more details of my code or are just curious on what I am working on, please let me know and I will be more than happy to help.

Thank You once again for your time. Have a wonderful day.

$\endgroup$
1

2 Answers 2

4
$\begingroup$

The answer to your first question is: "yes". Try this, for example: This is such a matrix:

m = {{1, 4, 0, 0}, {3, 4, 1, 0}, {0, 2, 3, 4}, {0, 0, 1, 3}};

This makes plots of its columns:

 ListPlot[#, PlotStyle -> PointSize[0.03]] & /@ 
 Table[Transpose[m][[i]], {i, 1, Length[m]}]

with the effect

enter image description here

The answer to your second question is: "yes". This places all the plots into a grid:

    Grid[Partition[
  ListPlot[#, PlotStyle -> PointSize[0.03]] & /@ 
   Table[Transpose[m][[i]], {i, 1, Length[m]}], 2]]

returning the following:

enter image description here

You may equally use the GraphicsGrid instead.

Have fun!

$\endgroup$
1
  • $\begingroup$ @Jason B " Grid is far superior to GraphicsGrid", Well, and? "Also, you can really make the grid of plots look nice..." Yes, there are many ways to make them look nice, nicer, still nicer. But the OP question is different. $\endgroup$ Oct 8, 2015 at 7:47
2
$\begingroup$

@AlexeiBoulbitch demonstrated the use of (Graphics)Grid.

To do a bulk export you can, for instance, use this:

SetDirectory["/path/to/output/directory/"];
Table[Export["plot-"<>ToString[j]<>".pdf",
      ListLinePlot[MatSE[[51 - j]]],
      {j,50}]
$\endgroup$

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