# How to store multiple plots to be viewed later

I need to be able to import my data and create multiple listlineplots, but my inputs for each plot are very large. I am able to assign variables to each plot and then use GraphicsGrid to view them all, but i have to copy and paste the input for each plot. I am wondering if there is a way to create the plot, store it, then create the next plot and store it along with the first, and so on. This way when i am done creating all plots I can just view them all and compare them together in a grid. I have attempted to use AppendTo, but i am unable to even store two plots, as the first plot is erased in some manner. Here is an example of how I start:

        SetDirectory["Z:\\130709"];
filename = "af.txt";
datafile = Import[filename, "CSV"];
plot = ListLinePlot[datafile]
filename2 ="ai.txt";
datafile2 = Import[filename2,"CSV"];
plot2 = ListLinePlot[datafile2]
AppendTo[plot,plot2]


So I am trying to store the plot, and then my hope is to just change the input filename and continue on to save space. Any help would be appreciated.

-
Does AppendTo[{plot}, plot2] work? If the plots are large, I think you can consider Rasterize them, which I think would be faster. –  xslittlegrass Jul 10 '13 at 17:26

I guess your data files are named well, I mean according to some pattern.

However here is a n example

SetDirectory[NotebookDirectory[]];

(*creating data file with serial name*)
Table[Export[StringJoin[ToString[n], ".dat"],
Table[{x, Sin[n x]}, {x, 0., 2 \[Pi], \[Pi]/10.}], "Table"], {n, 1, 3}]


This will create three data file {"1.dat", "2.dat", "3.dat"}. Now you can Import data from files, one by one, and put all the Plots in a table.

graph = Table[data = Import[StringJoin[ToString[n], ".dat"]];
ListLinePlot[data], {n, 1, 3}];
graph // TableForm


graph has all your plots. You can put all of them in a table or can call the individually.

-
this helps, thank you very much –  JoshRPD Jul 10 '13 at 20:11

You can do a Grid for your plot and then export the grid.

let us take an example:

Export["plot.jpg",
Grid[{ {ListPlot[RandomReal[1, 100]],Plot[Sin[x], {x, 0, 1}]} }]
]


-